I'm trying to redirect (note without query strings):
http://www.reviews.com/review/review_review.cfm?review_id=135223
to
http://www.reviews.com/
The current rule:
Redirect 301 /review/review_review.cfm http://www.reviews.com/
Causes the original URL to redirect to http://www.reviews.com/?review_id=135223
Based on a few stack questions here and here, I should be able to add a ?
to the Redirect rule as below:
Redirect 301 /review/review_review.cfm http://www.reviews.com/?
but this redirects to http://www.reviews.com/?
. The trailing ? remains. How do I get rid of this it's killing me.
You can't get rid of the extraneous ?
using mod_alias. The ?
will prevent a query string from getting appended but with mod_alias, it unfortunately includes a ?
as part of the redirect. However, mod_rewrite won't, because adding the ?
to the end, which tells it to not include any existing query string, works the same way as mod_alias, but after that it gets processed again by mod_alias, minus the trailing ?
, so the end result is no trailing ?
at the end of the URL. So something like:
RewriteEngine On
RewriteRule ^/?review/review_review.cfm$ http://www.reviews.com/? [L,R=301]
And this would replace the Redirect
statement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With