【发布时间】:2014-12-27 00:36:26
【问题描述】:
我的产品网址如下所示:http://www.example.com/products/handbags/leather-handbag-model-ba123
其中handbags 是类别名称,它是动态变化的。
leather-handbag-model-ba123 是产品唯一的 url,并且也在动态变化。
在.htaccess 文件中我有这个:
RewriteCond %{THE_REQUEST} /(products)/([^\s&]+)/([^\s&]+) [NC]
RewriteRule /%1/%2/index.php [L]
应该加载位于 /products/handbags/index.php 中的 index.php 文件,但代码返回错误 404。
将加载特定类别的 index.php 文件(示例中为handbags)的正确代码是什么?
【问题讨论】:
-
你在“products/handbags”中有一个文件“index.php”吗?如果你不...那么这就是你得到 404 的原因。你需要很多文件夹,其中包含“index.php”。那将是...每个类别 1 个文件夹...
-
是的,我在每个分类文件夹中都有 index.php
标签: php apache .htaccess redirect