简体   繁体   中英

REQUEST_URI is populated with default-file (DirectoryIndex) /index.html

After a migration to a new server with Centos some behaviour changed.

The environment-variable REQUEST_URI contains '/index.html' when http://example.com is fetched (without the index.html).

I would expect:

REQUEST_URI is '/' when http://example.com is fetched.

REQUEST_URI is '/index.html' when http://example.com/index.html is fetched.

This has consequences in my .htaccess (rewriterules react on 'index.html' instead of 'empty string'), as well as in my scripts (Perl $ENV{'REQUEST_URI'})

How to provoke REQUEST_URI being populated with '/' when only http://example.com is fetched?

Try disabling DirectoryIndex and MultiViews, place this at the top of your .htaccess:

DirectoryIndex disabled
Options -MultiViews

Seems the problem only occurs when in Plesk 'Hosting settings' PHP Support is set to

'Run PHP as FPM application served by nginx'

when i change it to

'Run PHP as FPM application served by Apache' or 'Run PHP as FastCGI application served by Apache'

there's no problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM