问题
I need advice how to remove a parameter from the url using. Htcaccess
The condition is as follows:
redirect url from:
http://example.com/?movie=2&ref=nf
to:
http://example.com/?movie=2
I tried several options but I have not come to nothing
Thank you for your ideas / advice.
THX.
回答1:
Try adding the following to the .htaccess
file in the root directory of your site.
RewriteEngine on
RewriteBase /
#If request contains ref param
RewriteCond %{THE_REQUEST} \?([^&\ ]+)&ref= [NC]
#redirect to URL without the ref param
RewriteRule ^ %{REQUEST_URI}?%1 [L,R=301]
来源:https://stackoverflow.com/questions/9301125/remove-parameter-from-url-viac-htaccess