本文介绍了友好的URL(MOD重写)问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我试图让好的网址,第一条规则正常工作,它的转向
I am trying to make "nice" URL, first rule works as expected, it's turning
www.blabla.com/index.php?page=tags&tag=blabla
www.blabla.com/index.php?page=tags&tag=blabla
到
www.blabla.com/tags/blabla
www.blabla.com/tags/blabla
但第二条规则不工作?
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /index.php?page=$1&tag=$2 [L]
RewriteRule ^([^/]*)/([0-9]*)$ /index.php?page=$1&article=$2 [L]
比你
推荐答案
由于数字可以被认为是任何东西,但正斜杠( /
),你应该把文章标签规则之前,规则:
Since numbers could be considered as anything but a forward slash (/
), you should put the article rule before the tag rule:
RewriteEngine On
RewriteRule ^([^/]*)/([0-9]*)$ /index.php?page=$1&article=$2 [L]
RewriteRule ^([^/]*)/([^/]*)$ /index.php?page=$1&tag=$2 [L]
这篇关于友好的URL(MOD重写)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!