问题
I want to use htaccess to 301 redirect (not rewrite) urls like:
brands.php?brand=Sony
to
brands/Sony
How can i do that? Appreciate your help in advance.
回答1:
So your users are entering brands.php?brand=Sony
into their browser, and being redirected? If I have that correct, it's simple:
RewriteEngine On
RewriteCond %{QUERY_STRING} brand=([^&]+) [NC]
RewriteRule brands\.php brands/%1 [L,R=301]
来源:https://stackoverflow.com/questions/7796421/301-redirect-url-with-variable