Our blog

 

Zend Framework 1and1 Index Controller 404s + Solution

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:

CODE:
  1. Options -MultiViews

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

CODE:
  1. Options -MultiViews
  2. RewriteEngine On
  3. RewriteCond %{REQUEST_FILENAME} -s [OR]
  4. RewriteCond %{REQUEST_FILENAME} -l [OR]
  5. RewriteCond %{REQUEST_FILENAME} -d
  6. RewriteRule ^.*$ - [NC,L]
  7. 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 /

More...

More Reading:

8 Comments

warthpublishinginc
April 12th, 2009

Your problem may be with 1and1. Check out why the Pennsylvania Better Business Bureau has given 1and1 their lowest rating “F.”
“Customer Complaint History
Back To Top
The company's size, volume of business and number of transactions may have a bearing on the number of complaints received by the BBB. The complaints filed against a company may not be as important as the type of complaints, and how the company has handled them. The BBB generally does not pass judgment on the validity of complaints filed.
Number of complaints processed by the BBB
in the last 36 months: 691
in the last 12 months: 276”
Warth Publishing Inc

 

Roman
August 16th, 2010

Thank you so much, I've spend many hours trying to solve this problem on GoDaddy shared hosting, my ajax calls to IndexController actions returned 404 and no POST data received, maybe i missed something in host configs but these are the default settings, bottom line, adding "Options -MultiViews" solved the problem immediately.

 

Ben
October 24th, 2010

This was a great help. I was dying for half a day before I found this.

 

Marto
December 9th, 2010

Thanks a lot man! You saved me a lot of trouble with this helpful post! I was very upset (not to mention confused) early this morning when i discovered that my IndexController can't be invoked other than with "virtualhost" (defined by me name)... :) Once again - THANK YOU! Be well! :)

 

Rajasekhar
August 7th, 2011

great post and great help!! you saved my day! thank you!

 

[...] the answer here: After some digging around, the solution is to disable something called MultiViews. The MultiViews [...]

 

Kostya
September 9th, 2011

Thank you! Your post help me!

 

nachiketa kashyap
October 31st, 2011

Thanks alot brother, been working around the htaccess for a while for this...

 

 

Leave a Reply