Server Fault is a question and answer site for system and network administrators. 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 a default .htaccess file that comes with drupal. In order to redirect externally linked pages from the old website to the new one I usually use statements like

Redirect /foo

This works as expected.

But the statement is totally ignored when looking like

Redirect /index.php?x=y

and the request runs through the mod_rewrite rules from Drupal at the end of the .htaccess file.

Do you know what is the problem?

share|improve this question
up vote 1 down vote accepted


Redirect does not match URL parameters, it will only match the PATH of a url.


You CAN match the QueryString variable with RewriteCond and RewriteRule. Here is a working (but untested) snippet that you can try:

RewriteCond %{QUERY_STRING} x=y
RewriteRule ^index.php [R=301]

You should note a few things about this:

  1. The RewriteCond line is really a regex (regular expression), so you will have to escape any special characters you add to it (such as punctuation), and the first ? is omitted, but any further URL parameters with have to include the & (RewriteCond %{QUERY_STRING} x=y&a=b).
  2. This method is equvilent to a Redirect, because I specified the HTTP status code (a HTTP 301 Redirect, which is permanent).


share|improve this answer

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.