I've searched and tried many examples but none seem to work for me. I need to redirect a request to a specific url depending on if the original request had a certain item in it's query string.
e.g.
www.mydomain.com/test.html?username=foo&password=bar
So I want to redirect this only is the username variable is present in the query string to
www.mydomain.com/home.html?username=foo&password=bar
But also, the page could be any page, .e.g test.html, home.html, contact.php
So if username variable is 开发者_JS百科detected in query string, then the redirect will happen only.
thanks for your help.
I tried this but it did not work:
RewriteRule ^username(.*)$ test.html?username=$1 [L,QSA]
You can use QUERY_STRING to accomplish this.
RewriteCond %{QUERY_STRING} username
RewriteCond %{REQUEST_URI} !^/home.html
RewriteRule .* /home.html/ [L,QSA]
精彩评论