Apache mod_rewrite: Request exceeded the limit of 10 internal redirects

For a current project I needed to use Zend Framework with its Model-View-Controller classes. The default .htaccess is advised as follows:

While this worked fine on our servers at work, it did not on my home station. Apache gave me an internal server error, and the log showed me:

uri = /home/cweiske/Dev/html/index.php
[Sat Nov 10 07:41:01 2007] [debug] core.c(3052): [client 127.0.0.1] /redirected from r->uri = /home/cweiske/Dev/html/index.php
[Sat Nov 10 07:41:01 2007] [debug] core.c(3052): [client 127.0.0.1] /redirected from r->uri = /home/cweiske/Dev/html/index.php
[Sat Nov 10 07:41:01 2007] [debug] core.c(3052): [client 127.0.0.1] /redirected from r->uri = /home/cweiske/Dev/html/index.php
[Sat Nov 10 07:41:01 2007] [debug] core.c(3052): [client 127.0.0.1] /redirected from r->uri = /home/cweiske/Dev/html/index.php
[Sat Nov 10 07:41:01 2007] [debug] core.c(3052): [client 127.0.0.1] /redirected from r->uri = /home/cweiske/Dev/html/index.php
[Sat Nov 10 07:41:01 2007] [debug] core.c(3052): [client 127.0.0.1] /redirected from r->uri = /home/cweiske/Dev/html/index.php
[Sat Nov 10 07:41:01 2007] [debug] core.c(3052): [client 127.0.0.1] /redirected from r->uri = /home/cweiske/Dev/html/index.php
[Sat Nov 10 07:41:01 2007] [debug] core.c(3052): [client 127.0.0.1] /redirected from r->uri = /home/cweiske/Dev/html/index.php
[Sat Nov 10 07:41:01 2007] [debug] core.c(3052): [client 127.0.0.1] /redirected from r->uri = /home/cweiske/Dev/html/index.php
[Sat Nov 10 07:41:01 2007] [debug] core.c(3052): [client 127.0.0.1] /redirected from r->uri = /
]]>

This problem has been asked some times in forums around the world, but nobody knew an answer. While asking on #apache, I remembered that I am using dynamically configured virtual mass hosting and already had some problems with it. Declaring an explicit <VirtualHost> actually helped! Now a mix of mass hosting and name based hosts (name based hosts last!) works absolutely fine.

Here is my apache2 site configuration:


    UseCanonicalName Off

    LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
    CustomLog /var/log/apache2/access_log vcommon

    VirtualDocumentRoot /home/cweiske/Dev/html/hosts/%0
    
        AllowOverride all
    

root@bogo:/etc/apache2/sites-enabled# cat 050-neatful 

    ServerName neatful.bogo
    DocumentRoot /home/cweiske/Dev/html/neatful.de/

    
        AllowOverride All
    

]]>

Written by Christian Weiske.

Comments? Please send an e-mail.