开发者

Friendly URL (mod-rewrite) issue

开发者 https://www.devze.com 2023-03-15 21:48 出处:网络
Hallo, I am trying to make \"nice\" URL, first rule开发者_开发百科 works as expected, it\'s turning

Hallo,

I am trying to make "nice" URL, first rule开发者_开发百科 works as expected, it's turning

www.blabla.com/index.php?page=tags&tag=blabla

into

www.blabla.com/tags/blabla

but second rules doesn't works?

 RewriteEngine On
 RewriteRule ^([^/]*)/([^/]*)$ /index.php?page=$1&tag=$2 [L]
 RewriteRule ^([^/]*)/([0-9]*)$ /index.php?page=$1&article=$2 [L]

Than you


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]
0

精彩评论

暂无评论...
验证码 换一张
取 消