首页 > 解决方案 > REQUEST_URI 填充有默认文件 (DirectoryIndex) /index.html

问题描述

在使用 Centos 迁移到新服务器后,一些行为发生了变化。

当获取http://example.com(没有 index.html)时,环境变量 REQUEST_URI 包含“/index.html”。

我希望:

获取http://example.com时,REQUEST_URI 为“/” 。

获取http://example.com/index.html时,REQUEST_URI 为“/index.html” 。

这对我的 .htaccess 有影响(重写器对'index.html'而不是'空字符串'做出反应)以及我的脚本(Perl $ENV{'REQUEST_URI'})

当仅获取http://example.com时,如何激发 REQUEST_URI 填充“/” ?

标签: apacherequest-uridirectoryindex

解决方案


似乎问题仅在 Plesk 'Hosting settings' PHP Support 设置为

'将 PHP 作为 nginx 服务的 FPM 应用程序运行'

当我将其更改为

'将 PHP 作为 Apache 提供的 FPM 应用程序运行'或'将 PHP 作为 Apache 提供的 FastCGI 应用程序运行'

这里没有问题。


推荐阅读