1

I have a site that has a bunch of URLs indexed in Google that look like this -

http://www.domain-namr.com/?option=filter&option2=&option3=

I am trying to redirect all of these to a new URL in HTACCESS with this code -

RewriteCond   %{REQUEST_URI}    ^/$
RewriteCond   %{QUERY_STRING}   ^option=filter$
RewriteRule   ^(.*)$ /new-url.html [R=301,L]

Of course it is not working. On all of the pages that have a filename I can use in the request uri condition, the redirects work. What am I missing?

1 Answer 1

1

It is not working due to the wrong regex pattern in your rule.

Try this rule as your very first rule in root .htaccess:

RewriteCond %{QUERY_STRING} ^option=filter(&|$) [NC]
RewriteRule ^$ /new-url.html? [R=301,L]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.