Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
#Hide Index
IndexIgnore *

#Define ErrorDoc
ErrorDocument 404 http://www.domain.com

#REDIRECTS
Redirect 301 /page.php http://domain.com
Redirect 301 /inc/page.php http://domain.com


Options +FollowSymlinks
RewriteEngine on

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

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


#Rewrite www to domain 
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/$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
add comment

1 Answer

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

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

share|improve this answer
add comment

Your Answer

 
discard

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.