问题
Using the file .htaccess, I am trying to redirect urls like this:
http://www.mysite.com/a-page/?fp=123&sp=456&tp=789
to:
http://www.mysite.com/a-page/
so basically redirecting url not caring about params values to the same url without any param.
I have used RewriteCond/RewriteRule, Redirect and RedirectMatch but without any luck.
My latest try was:
RewriteCond %{QUERY_STRING} ^.+$
RewriteRule ^a-page/$ http://www.mysite.com/a-page/? [L,R=301]
Any suggestion?
回答1:
Well I have found a solution:
RewriteCond %{QUERY_STRING} . [NC]
RewriteCond %{REQUEST_URI} /a-page/
RewriteRule ^ a-page/? [L,R=301]
来源:https://stackoverflow.com/questions/13788128/redirecting-url-with-parameters-to-same-url-without-parameters