不工作的mod_rewrite规则 [英] mod_rewrite rule not working
问题描述
我有以下规则htaccess的我:
I have the following rules in my htaccess:
RewriteRule ^([^/.]+)/?$ list.php?categoryShortForm=$1&locationShortForm=world [QSA]
RewriteRule ^([^/.]+)/([^/.]+)/?$ list.php?categoryShortForm=$1&locationShortForm=$2 [QSA]
RewriteRule ^([^/.]+)/([^/.]+)/[^/.]*-p([0-9]+)/?$ view.php?categoryShortForm=$1&locationShortForm=$2&postingId=$3 [QSA]
在我的本地主机(窗口,XAMPP),这一切工作正常。
在我的真实服务器(Linux操作系统,Apache)第2规则做工精细,但不存在第三之一。
In my localhost (windows, xampp), it all works fine. In my real server (linux, apache) the first 2 rules work fine, but not there 3rd one.
例如:
/整形外科/加利福尼亚-USA /
工作正常,但 /整形外科/洛杉矶 - 洛杉矶 - 加州 - 美国/测试-1-P1
给我一个404
/plastic-surgery/california-usa/
works fine, but
/plastic-surgery/los-angeles-california-usa/test-1-p1
gives me a 404
任何想法??
推荐答案
检查以确保您可以直接浏览到目标URL。如果mod_rewrite的正在改写到的东西不存在,你会得到404它可能有助于mod_rewrite的日志级别冲高到高价值,所以你可以看到它的重写。
Check to make sure that you can browse directly to the target URLs. If mod_rewrite is rewriting onto something that doesn't exist, you'll get that 404. It might help to ratchet up mod_rewrite's log level to a high value, so you can see what it's rewriting to.
这篇关于不工作的mod_rewrite规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!