【发布时间】:2015-10-01 07:12:31
【问题描述】:
我在我的 htaccess 文件中有一些 url 重写,在本地都可以正常工作,但在服务器上,只有一页的规则导致问题(它不工作)。这是我的 htaccess 规则
#allStroes
RewriteRule ^allstores?$ allstores.php [L,QSA]
RewriteRule ^allstores/([^/.]+)/?$ allstores.php?type=$1 [L,QSA]
RewriteRule ^allstores/([^/.]+)/([^/.]+)/?$ allstores.php?type=$1&title=$2 [L,QSA]
我做错了吗?请帮忙
【问题讨论】:
-
页面是“allstores.php”,可以用类型和标题作为参数。我希望它只是“/allstores”或“allstores/type”或“allstores/type/title”
-
@anubhava 对其他页面的重写工作正常。我的规则可能存在一些问题(但它在本地机器上运行良好)。
-
是的,问题是针对生产的。并且 htaccess 在那里启用
-
是的!
http://domain.com/allstores导致 404 。我在服务器上的 htaccess 中添加了随机垃圾字符串,它给了 500。这意味着它在那里启用。 -
好的,现在可以显示完整的 .htaccess 了吗?还要告诉这个 .htaccess 的位置
标签: php apache .htaccess mod-rewrite url-rewriting