I’m looking to do an Apache redirect using %{QUERY_STRING} but it simply isn’t working.
I am wanting to redirect any web page query that has a string anywhere in the URL. So for example:
http://www.domain.com/328kadf83/dkad83kd/test83283/
The string would be “test” as shown above.
I tried this, but it doesn’t seem to be working:
RewriteEngine On
RewriteCond %{QUERY_STRING} test
RewriteRule (.*) http://www.other_domain.com/page.html [R=301,L]
What I am doing wrong in this case? The main thing is – the redirect needs to match anywhere in the URL where the string “test” appears – and it will then redirect to a specific web page.
The other questions I’ve seen on here are specifically for a directory or those with variables after a page name.
Thank you!
Should be something like this: