Reputation: 55
I have tried numerous variations of redirects, rewrites conditions and rules based on research and although I know I have a lot to learn with redirects, I am really struggling to figure out how to redirect a query string to my root directory :/
I need to redirect http://www.stapletondenver.com/news/press_detail.asp?pressReleaseID=10 to http://www.stapletondenver.com
Again, I've tried a few variations including below:
RewriteCond %{QUERY_STRING} ^/news/press_detail.asp?pressReleaseID=10$
RewriteRule (.*) /? [R=301,L]
Am I on the right track and/or what am I doing wrong? All and any help is greatly appreciated, thanks in advance!
Upvotes: 1
Views: 139
Reputation: 143946
Try:
RewriteCond %{QUERY_STRING} ^pressReleaseID=10$
RewriteRule ^/?news/press_detail\.asp$ /? [R=301,L]
The %{QUERY_STRING}
variable is only the query string, not any part of the URI.
Upvotes: 2