How to pass GET parameters to rewritten URL?

Posted by Jakobud on Pro Webmasters See other posts from Pro Webmasters or by Jakobud
Published on 2011-12-09T21:13:46Z Indexed on 2012/04/04 5:40 UTC
Read the original article Hit count: 382

Filed under:
|
|
|

I have an .htaccess rewrite rule like this:

RewriteCond %{SCRIPT_FILENME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^search/(.*)$ search.php?q=$1

What this does is, if someone visits http://www.mysite.com/search/test the URI that is really processed is http://www.mysite.com/search.php?q=test.

Now, if I try to pass an extra random GET parameter to my rewritten URL, the parameter is ignored. So if I try to do visit here:

http://www.mysite.com/search/whatever?extra=true

The parameter extra is ignored. It doesn't seem to get passed at all.

Can this problem be fixed? If so, how?

© Pro Webmasters or respective owner

Related posts about php

Related posts about apache