Zend Framework Rewrite with 1&1 Web Hosting

If you plan to host your Zend-based web-application on a 1&1 ( 1and1 / 1und1 ) server, you should consider the two following special features in the .htaccess-file:

  • The first one is to define the RewriteBase for your project which is simply the root directory /. Otherwise you will get an HTTP error 500 (or something like that).
  • And the second one is to disable the Multiviews option. Otherwise you will get the HTTP error 404 (or something like that).
1
2
3
4
5
6
7
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php 
 
RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
Options -MultiViews

Btw: PHP5 is not enabled by default. So that’s why I inserted the AddType and the AddHandler statements at the beginning. ;)

10 Responses to “Zend Framework Rewrite with 1&1 Web Hosting”


  • hi,

    I have the same problem. have a look at this http://shoqproject.supervisionbielefeld.de/public/

    the first page is displayed but when I click on login I get a 404 error. any ideas? I have the same htaccess described above

  • Thanks, Stephan. This worked like a charm for me. Here is my final .htaccess file for my Zend Framework app:

    AddType x-mapp-php5 .php
    SetEnv APPLICATION_ENV production
    Options -MultiViews
    RewriteEngine ON
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ – [NC,L]
    RewriteRule ^.*$ index.php [NC,L]

  • thank you very much :D

  • Thanks for the hint concerning MultiViews! I was having trouble getting mydomain.com/index/index to work. It always yielded 404.

    You should have your article linked into the 1und1-FAQ !

    Thanks again!
    Tobias :-)

  • Many thx for that tip! Allready thought i can not use ZF.
    Rafael

  • Unfortunately, this is not working for me :( Was there anything else needed? I’m trying it out with the quick-start app and have set the destination directory in the 1and1 admin to the ‘public’ directory:

    /
    /application
    /data
    /library
    /public <—– html and css/etc are here and dest-dir in 1and1 admin points here
    /scripts

    Any ideas?

    Thank you in advance!

    • Actually, the .htaccess script above helped me to solve the issue concerning the quick-start app and 1&1. It is absolutely right to set the destination directory to the public folder. Do you get an error message (e.g. 500, 404) as mentioned in the post?

      Btw: I use 1&1 in Germany. Maybe there’s a difference in the internal server configuration? Hmm, I don’t think so…

Leave a Reply