regex - htaccess redirect from /foo/bar/ to foo.php?q=bar -


as question states have managed foo.php?q=bar /foo/bar ,using below

rewritecond %{query_string} ^q=(.*)$ rewriterule ^foo\.php$ foo/%1? [r=301,l] 

how want /foo/bar redirected foo.php?q=bar while checking if

foo = foo, file named dosearch exists , gets redirected

dosearch/data 

now want see if

/(.*)/(.*)  

that first match dosearch , if dosearch.php?q=$2

edit:

this new htaccess keeps giving me "too many redirects"

options +followsymlinks -multiviews  rewriteengine on rewritebase /   rewritecond %{query_string} ^q=(.*)$ rewriterule ^dosearch\.php$ dosearch/%1? [r=301,nc,l]  rewriterule ^dosearch/([^/]+)? dosearch.php?q=$1 [nc,l] 

any appretiated guys......

hello think got following appends no query though there....if can point out...it nice.

options +followsymlinks +multiviews  rewriteengine on rewritebase /   rewritecond %{the_request} ^[a-z]{3,9}\ /dosearch\.php\?q=(.*)\ http/   rewriterule ^dosearch\.php$ dosearch/%1?  [r=302,l]  rewriterule ^dosearch/([^/]+)? dosearch.php?q=$1 [nc,l] 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -