Apache 的 MultiViews 选项不起作用

Apache 的 MultiViews 选项不起作用

系统规格

  • 苹果操作系统塞拉
  • Brew 安装:Apache/2.4.23

当我访问 localhost/mypage.php => 时有效

当我访问 localhost/mypage => 时不起作用

我的配置

# /usr/local/etc/apache/2.4/extra/httpd-vhosts.conf

<VirtualHost *:80>
        ServerName localhost
        Redirect permanent / https://localhost/
</VirtualHost>

<VirtualHost *:443>
        ServerName localhost
        DocumentRoot "/Users/myuser/Documents/mywebsite/httpdocs"
        DirectoryIndex index.php
        <Directory "/Users/myuser/Documents/mywebsite/httpdocs">
                Options +FollowSymLinks +MultiViews -Indexes
                AllowOverride all
                Require all granted
        </Directory>
        SSLProtocol -all +TLSv1.2
        SSLHonorCipherOrder On
        SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
        SSLCertificateFile /usr/local/etc/apache2/2.4/ssl/localhost.crt
        SSLCertificateKeyFile /usr/local/etc/apache2/2.4/ssl/server.key
</VirtualHost>

我的故障排除

在选项行中,我尝试了以下操作:

  • 选项 +FollowSymLinks +MultiViews
  • 选项 FollowSymLinks MultiViews

是的,我确实重新启动了 Apache。

答案1

显然,MultiViews 依赖于谈判模块

Mac 安装 Apache 时默认注释掉了以下模块!!

# LoadModule negotiation_module libexec/mod_negotiation.so

我只是取消注释并重新加载 Apache。现在它工作了!

相关内容