Apache mod_rewrite stopped working when upgrading to 2.4.18

Matt Williams asked:

I am running Apache 2.4.18(Unix) on OS X.

It is interesting that this configuration works on Apache 2.2.15

I am attempting to access /foo/local on the domain, which I want rewritten to /index.php/foo/local.

The problem that I have is that inside the web root there is a foo.php file, and apache seems to only want to send traffic to /foo.php/local.

Is this something I have configured incorrectly in apache?

My rewrite rule is as follows:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [QSA,L]

The apache configuration for the web root is:

    <Directory />
            Options Indexes Includes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
    </Directory>

I have done some initial debug and found that REQUEST_FILENAME for /foo/local is /path/to/webroot/foo.php

Any help would be greatly appreciated

My answer:


This looks like it’s being caused by MultiViews.

MultiViews causes a request for foo to initiate a search for any file starting with foo. which the browser might be able to understand. When it finds foo.php, that gets served.

Just remove that from your configuration.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.