#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?

link|improve this question
feedback

1 Answer

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

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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