Zend Framework 1and1 Index Controller 404s + Solution

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

Been tearing my hair out this morning trying to figure out why a Zend Framework based app was giving me 404 messages on any actions that specified the index controller. To explain, any URL that ended with /index or index/{action_name} would give me the ugly 1and1 404 message.

locally of course it worked fine. I messed around with my error controller but it seemed that the ZF app wasn’t even being consulted, this was a lower level 404 error.

After some digging around, the solution is to disable something called MultiViews. The MultiViews option allows a file to be called even if the extension is not loaded, so index would look for any files called index, regardless of their extension.

I’m not really sure why you would want this behaviour, maybe that’s why I have never encountered it before. Anyway, to disable it and get your app working the way you want, simply add the following line to your htaccess file:

Options -MultiViews

For information, this is my full htaccess file that works on 1and1 hosting:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /path/from/docroot/public/ [NC,L]

This particular app is running from a subfolder. If your public folder is the document root then that line would simply be /