Gixxy22
Gixxy22

Reputation: 507

redirect query string to another query string

I am trying to 301 redirect a query string to another query string, but everything I am trying seems to be failing.

I am trying to accomplish this:

http://www.example.com/something?_dog to redirect to http://www.example.com/something?_cat http://www.example.com/page1?_dog to redirect to http://www.example.com/page1?_cat http://www.example.com/aboutus?_dog to redirect to http://www.example.com/aboutus?_cat

and thousands of other pages, so i need to keep the current url/directory etc but just redirect it to use a different query string. they will all be "?_dog" going to "?_cat"

any help much appreciated

Upvotes: 1

Views: 60

Answers (1)

anubhava
anubhava

Reputation: 785156

You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^_dog$ [NC]
RewriteRule ^ %{REQUEST_URI}?_cat [L,R=302]

Upvotes: 1

Related Questions