【发布时间】:2015-05-03 15:23:02
【问题描述】:
我想使用 htaccess 将我网站上的特定文件重写为另一个文件:
# General
RewriteEngine On
RewriteBase /
Options All -Indexes
Options +FollowSymLinks
# Rewrite file
RewriteRule ^/file.html$ /dir/file.html [L]
这是我使用的基于我在互联网上找到的 sn-ps 的 .htaccess 代码。 不知何故,这不起作用,服务器返回 404-Not-found 错误。
我看不出与据说有效的示例有任何区别,例如 Rewriting path for a specific file using htaccess
编辑: 如果我将 file.html 放在根文件夹中,我可以查看它。所以重写肯定不会发生。
【问题讨论】: