Nathan Travis
Nathan Travis

Reputation: 103

Redirecting all url's containing

I am trying to redirect multiple url's, but i cannot achieve / find exactly how to do it.

Basically what i need it to redirect all the pages that has in link ?page=test and ignores something=else

www.servername.com/en/?page=test&something=else

to

www.servername.com/en/redirected

here is what i tried

RewriteCond %{QUERY_STRING}  ^page=test\(\.\*\)$ [NC]
RewriteRule ^index\.php$ www.servername.com/en/redirected? [R=301,NE,NC,L] 

Upvotes: 1

Views: 42

Answers (1)

anubhava
anubhava

Reputation: 785481

Your regex in RewriteCond seems to be a problem, you can use:

RewriteCond %{QUERY_STRING} (^|&)page=actor(&|$) [NC]
RewriteRule ^ %{REQUEST_URI}/redirected? [R=301,NE,NC,L] 

Also you mention /en/ in your question and use /index.php in your example.

Upvotes: 2

Related Questions