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

207 views Asked by At

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?

2

There are 2 answers

1
Dusan Bajic On

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

DirectoryIndex disabled
Options -MultiViews
0
Roger Van Montfort On

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.