问题
I realise there are similar questions but I'm trying to work out how I can rewrite the following URL:
http://www.myWEBaddress.com/?month=200904
to
http://www.myWEBaddress.com/my-page.php?month=200904
Regards
回答1:
Add the following to the .htaccess
file in the root directory of your site.
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} (^|&)month= [NC]
RewriteRule ^ my-page.php [L]
If you want to change the URL that the user sees in their browser address bar, change the last rule to
RewriteRule ^ my-page.php [L,R=301]
来源:https://stackoverflow.com/questions/9113747/htaccess-redirect-with-variables