在htaccess中重写规则所有工作除了最后一条规则

时间:2012-03-25 21:48:19

标签: .htaccess

我的实际代码是这个,最后一条规则dsnt正常工作,有人可以帮忙吗?,

非常感谢!

RewriteEngine On RewriteCond %{HTTP_HOST} ^diamantesgould.net [NC]

RewriteRule ^(.*)$ http://www.diamantesgould.net/$1 [R=301]

RewriteRule ^([a-z0-9_-]+)$ /index.php?po=$1 [NC]

RewriteRule ^categories/([a-z0-9_-]+)$ /index.php?ca=$1 [NC]

RewriteRule ^videos/([a-z0-9_-]+)$ /video.php?movie=$1 [NC]

RewriteRule ^galleries/([a-z0-9_-]+)$ /galleries.php?gallery=$1 [NC]

注意:问题是它通过输入mydomain.com/galleries或mydomain.com/galleries/1或mydomain.com/galleries/1/2/3/4显示相同的页面...始终显示画廊页面(mydomain.com/galleries)

1 个答案:

答案 0 :(得分:0)

我在你的正则表达式中看到了一些可能不正确的东西:

[a-zA-Z0-9_-]+ should be [a-zA-Z0-9_\-]+, - is a special char so must be escaped to be used only as a char