user2536914
user2536914

Reputation: 45

redirect from specific request

I have something like this:

RewriteCond %{QUERY_STRING} ^something=true$
RewriteRule ^$              http://www.a123dress.com/     [R=301,L]

I want redirect ALL (*) request which have "?something=true" to

http://www.a123dress.com/

It works for:

http://www.a123dress.com/?something=true

I want rewrite for example:

http://www.a123dress.com/test/?something=true

to:

http://www.a123dress.com/test/

so cut off ?something=true like above in first example

Upvotes: 2

Views: 33

Answers (1)

anubhava
anubhava

Reputation: 785581

Your regex ^$ is just allowing home page / to be redirected. Change your rule to:

RewriteCond %{QUERY_STRING} ^something=true$ [NC]
RewriteRule ^ %{REQUEST_URI}? [R=301,L,NE]

Upvotes: 1

Related Questions