我试图在我的网站上拥有干净的 url,这是我试图实现的映射:
我在我的网站的根目录下制作了一个 htaccess 文件,其中包含以下代码:
RewriteEngine On
RewriteRule ^([^\/]+)\/?$ pages.php?q=$1 [L,QSA]
RewriteRule ^tags/([^/d]+)/?$ tags.php?q=$1 [L,QSA]
出于某种原因,标签重定向有效,但随后被其他重定向规则“吃掉”。不知道如何防止第二条规则这样做。
答案如下:
RewriteEngine On
RewriteRule ^tags/([^/d]+)\/? /tags.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_URI} !/tags
RewriteRule (.*) pages.php?q=$1 [L,QSA]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句