Hello all!
For those not familiar with mod vhost_alias it allows you to configure dynamic virtual hosts within apache.
For example loading
http://test.localdev/ reads from the dynamic site /var/www/
test , and loading
http://FOOBAR.localdev/ will read from /var/www/
FOOBAR
Heres is the configuration:
Code:
<VirtualHost *>
ServerName localdev
ServerAlias *.localdev
VirtualDocumentRoot /var/www/%-2+/
<Directory /var/www>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/%-2+>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
This works great and I can access any virtual site that has a directory entry in /var/www/.
However as soon as I throw a .htaccess with modrewrite into one of my dynamic virtual hosts I get some funky errors.
example .htaccess file in /var/www/test/:
Code:
RewriteEngine On
RewriteRule ^(.*)$ index.php
now when i load
http://test.localdev/ I get 500 internal server error:
[HTML]<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
dtbaker@gmail.com and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.2.3 (Debian) PHP/5.2.0-10 Server at test.localdev Port 80</address>[/HTML]
this is what I get in the error.log:
Code:
[Fri Aug 17 08:13:22 2007] [error] [client 192.168.5.80] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Fri Aug 17 08:13:22 2007] [debug] core.c(3027): [client 192.168.5.80] r->uri = /var/www/test/index.php
[Fri Aug 17 08:13:22 2007] [debug] core.c(3033): [client 192.168.5.80] redirected from r->uri = /var/www/test/index.php
[Fri Aug 17 08:13:22 2007] [debug] core.c(3033): [client 192.168.5.80] redirected from r->uri = /var/www/test/index.php
[Fri Aug 17 08:13:22 2007] [debug] core.c(3033): [client 192.168.5.80] redirected from r->uri = /var/www/test/index.php
[Fri Aug 17 08:13:22 2007] [debug] core.c(3033): [client 192.168.5.80] redirected from r->uri = /var/www/test/index.php
[Fri Aug 17 08:13:22 2007] [debug] core.c(3033): [client 192.168.5.80] redirected from r->uri = /var/www/test/index.php
[Fri Aug 17 08:13:22 2007] [debug] core.c(3033): [client 192.168.5.80] redirected from r->uri = /var/www/test/index.php
[Fri Aug 17 08:13:22 2007] [debug] core.c(3033): [client 192.168.5.80] redirected from r->uri = /var/www/test/index.php
[Fri Aug 17 08:13:22 2007] [debug] core.c(3033): [client 192.168.5.80] redirected from r->uri = /var/www/test/index.php
[Fri Aug 17 08:13:22 2007] [debug] core.c(3033): [client 192.168.5.80] redirected from r->uri = /var/www/test/index.php
[Fri Aug 17 08:13:22 2007] [debug] core.c(3033): [client 192.168.5.80] redirected from r->uri = /
I have increased 'LimitInternalRecursion' and I get the same error.
This setup with .htaccess works correctly if I configure test.localdev as a normal apache vhost. However defeats the purpose of a single dynamic virtual hosts configuration.
Has anybody has success with dynamic virtual hosts and .htaccess rewrite?
Oh I have also tried placing the modrewrite rules directly into the apache configuration (no .htaccess) and its still the same.
Hope someone can help!
Kind Regards,
Dave