使用重写引擎时,我得到 404
When using rewrite engine I get 404
我尝试在 .htaccess
中设置重写。
看起来像这样:
RewriteEngine On
RewriteRule ^main/?$ main.php [NC,L]
当我尝试转到 /main/
时,我得到状态 404,但是如果我创建一个文件夹 main
,它就会开始正常工作。可能是什么问题?
我的 apache 错误日志显示:
[Sun Jul 15 21:57:44.934337 2018] [negotiation:error] [pid 5527] [client ::1:49702] AH00687: Negotiation: discovered file(s) matching request: /home/mykolas/public_html/main (None could be negotiated).
经过数小时的谷歌搜索,我终于找到了解决方案。我只需要在 vhosts 文件的根目录中禁用 MultiViews。
我尝试在 .htaccess
中设置重写。
看起来像这样:
RewriteEngine On
RewriteRule ^main/?$ main.php [NC,L]
当我尝试转到 /main/
时,我得到状态 404,但是如果我创建一个文件夹 main
,它就会开始正常工作。可能是什么问题?
我的 apache 错误日志显示:
[Sun Jul 15 21:57:44.934337 2018] [negotiation:error] [pid 5527] [client ::1:49702] AH00687: Negotiation: discovered file(s) matching request: /home/mykolas/public_html/main (None could be negotiated).
经过数小时的谷歌搜索,我终于找到了解决方案。我只需要在 vhosts 文件的根目录中禁用 MultiViews。