【发布时间】:2017-04-05 10:03:27
【问题描述】:
我正在尝试使用 htacces 将 URL 栏中显示的 html 扩展名(如 www.mywebsite.com/about.html)重写为 www.mywebsite.com/about。
这是我正在使用的代码,但它似乎不起作用。谁能告诉我为什么这不起作用?非常感谢任何答案和/或解释!
ErrorDocument 404 /404.html
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^home index.html
RewriteRule ^about about.html
RewriteRule ^services services.html
【问题讨论】:
-
您必须查看 Apache 错误日志(请咨询您的主机以了解这些日志的位置)以获取有关错误的详细信息。我的猜测是你有重写循环,因为像
^services这样的模式会匹配/services和/services.html,然后无限重写为services.html。您可能只需要将[L]标志添加到这些并终止它们,如^services$ -
错误日志说明了什么?
-
错误日志显示如下:myurl/.htaccess: Option FollowSymLinks not allowed here
-
@MichaelBerkowski 你知道是什么导致了这个问题吗?
标签: .htaccess