i want to remove a parameter after the true url then redirection to the same url without this parameter
example :
i want to remove the parameter "r" from
http://www.mysite.com/123.html?r=1
and redirection to
http://www.mysite.com/123.html
using htaccess and 301 redirect
thank you
Try this:
RewriteRule ^123.html.? 123.html? [L]
Note how the second url ends with a ?
, this removes the query string.
Source: http://wiki.apache.org/httpd/RewriteQueryString
Better than using a final ?
, you should use the qsdiscard flag QSD
, and the permanent redirect flag R=301
. So for your example :
RewriteRule ^123\.html(.*)$ 123.html [QSD,L,R=301]
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