htaccess的重定向与变数 [英] htaccess redirect with variables
本文介绍了htaccess的重定向与变数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道有类似的问题,但我试图找出如何我可以重写以下网址:
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
到
http://www.myWEBaddress.com/my-page.php?month=200904
问候
推荐答案
以下内容添加到您的网站的根目录下的的.htaccess
文件。
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]
如果你想改变用户看到他们的浏览器地址栏中的URL,最后一个规则更改为
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]
这篇关于htaccess的重定向与变数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文