Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
#Hide Index
IndexIgnore *

#Define ErrorDoc
ErrorDocument 404

Redirect 301 /page.php
Redirect 301 /inc/page.php

Options +FollowSymlinks
RewriteEngine on

#Redirect all pages in a folder to a single URL
RewriteRule ^dir/(.*)$ [L,R=301]

#Redirect String
RewriteRule ^index.php?var1=value&var2=(.*)&var3=(.*)$ [L,R=301]

#Rewrite www to domain 
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*)$$1 [R=301,NC] 

I'm using the above htaccess file to 301 redirect pages that have been removed from the server to the home page.

Can anyone tell me why the line #redirect string does not rewrite to the home page?

share|improve this question

It's likely due to the unescaped ? in your match string.

Try ^index\.php\?var1=value&var2=[^&]*&var3=[^&]*$.

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.