Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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

Can this problem be fixed? If so, how?

share|improve this question
up vote 9 down vote accepted

You are looking for the Query String Append flag - e.g.

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

See the mod_rewrite documentation for a full description of RewriteRule flags.

share|improve this answer
Ah nice! I knew there was something like that. I'm a .htaccess noob. – Jake Wilson Dec 9 '11 at 22:09
Is there a way to add QSA to all rules – hakkikonu Sep 23 '14 at 7:57
Hi @danlefree Know it's an old question, but using Wamp, when i do this, all my stylesheets, scripts etc lose reference. how can I solve that? – DannyG Nov 4 '15 at 16:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.