Jump to content

mod_rewrite question


dzhax

Recommended Posts

I have the following .htaccess

Options +FollowSymLinks  RewriteEngine On  RewriteCond %{SCRIPT_FILENAME} !-d  RewriteCond %{SCRIPT_FILENAME} !-f  RewriteRule ^(.*)$ index.php?str=$1 [L]

It works wonders for urls likehttp://www.example.com/browseworks finebut when I dohttp://www.example.com/browse?action=dothisI am unable to get the ?action=dothis...All that gets passed is browsehow can i make the following url returnex.

http://www.example.com/index.php?str=browse&vars=action=dothis

ex.

http://www.example.com/index.php?str=browse&vars=action=dothis&action2=dothisalso

Link to comment
Share on other sites

  • 3 weeks later...
any ideas?
Hope this helps even if it's some time since you posted..A debugging tip:echo $_SERVER['SCRIPT_FILENAME'] "?" $_SERVER['QUERY_STRING'];This will output the query you send to the server after the rewrite.What's wrong with your code well if you look at it you are outputing two ? where it only should be one.your output: index.php?str=browse?action=dothisif you type: http://www.example.com/browse&action=dothisyour output will be: index.php?str=browse&action=dothisI think you are after this flag [QSA] which will append the rest of your query_string so you can write like this:http://www.example.com/browse?action=dothis
Link to comment
Share on other sites

any ideas?
Hope this helps even if it's some time since you posted..A debugging tip:echo $_SERVER['SCRIPT_FILENAME'] "?" $_SERVER['QUERY_STRING'];This will output the query you send to the server after the rewrite.What's wrong with your code well if you look at it you are outputing two ? where it only should be one.your output: index.php?str=browse?action=dothisif you type: http://www.example.com/browse&action=dothisyour output will be: index.php?str=browse&action=dothisI think you are after this flag [QSA] which will append the rest of your query_string so you can write like this:http://www.example.com/browse?action=dothis
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...