This may be a cinch for some, but after a couple hours of tinkering I still can't get it. I want to 301 redirect DOMAIN/FOLDER/mt-comments.cgi?__mode=red&id=ANY to www.DOMAIN.com The tricky part is that I only want to trigger the redirect if the url contains ?__mode=red - if I trigger the redirect for any query string following mt-comments.cgi I run into other unacceptable problems. Thanks!
Try RewriteEngine on RewriteCond %{REQUEST_URI} ^/folder/mt-comments.cgi RewriteCond %{QUERY_STRING} __mode=red RewriteRule (.*) http://www.domain.com [R=301] Code (markup): cheers johnt
Thank you so much Johnt!! The redirect works under the right conditions and doesn't interfere with mt-comments.cgi functionality. One last question: once the redirect happens, the URL looks like this: www.DOMAIN.com/?__mode=red&id=ANY Is there a way to strip off the ?__mode=red&id=ANY Thanks!
If you want to get rid of the entire query string after a redirect you can use ? after the url you are redirecting to, i.e. RewriteEngine on RewriteCond %{REQUEST_URI} ^/folder/mt-comments.cgi RewriteCond %{QUERY_STRING} __mode=red RewriteRule (.*) http://www.domain.com/? [R=301] Code (markup): If you need to keep other aspects of the query string but just remove that one parameter / value pair, I'm not sure if you can do that. However, in this instance I think that the above is what you're after. cheers johnt
Will that work for individual pages pointed to different URL'S, or does it only work for one domain to another?