【发布时间】:2016-12-17 21:30:25
【问题描述】:
我在子目录中有以下 htaccess 代码
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([0-9]+).html$ order-details.php?id=$1 [NC,L]
它工作正常。问题是该目录中的每个其他页面都会给出错误 404。
链接 example.com/sub/sub/123456.html 工作正常。此外,example.com/sub/sub/ 工作正常,因为我在子目录中有一个索引文件。但是,example.com/sub/sub/anotherpage.html 给出错误 404。删除 htaccess 解决了一个问题并带来了另一个问题。
example.com/sub/sub/
【问题讨论】:
-
所以基本上您希望
123456.html转到order-details.php页面,但anotherpage.html只显示该目录中存在的真实 anotherpage.html 页面? -
是的,这正是我想要的
标签: apache .htaccess mod-rewrite