if you are using the vhost_alias_module and you want clean URLs, the default .htaccess will give you an infinite internal redirect loop. Two things shall be done to prevent this. Let's suppose that the DocumentRoot is /var/www/htdocs and drupal is installed in /var/www/htdocs/mydomain/drupal . In this case, the first thing is:

RewriteBase /mydomain/drupal/

This is easy to figure out. Second -- this took me some time -- you should add a slash before the index.php in the RewriteRule line:

RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

Karoly Negyesi


mani’s picture

Thanks for this hint! It stops hours of desperate search.

        \ | /
         @-@  Mani
        \ | /
         @-@  Mani
cwells’s picture

Wow, I know this is from May 2004 - but it just saved me a big headache, I think.

So, not to dredge up something from 5 years ago... but why isn't this in the default .htaccess file in D6?


MKorostoff’s picture

Ten years later, this is STILL the best answer on the web. THANK YOU. Here's what finally worked for me:

In httpd.conf:

<Virtualhost *:80>
    UseCanonicalName Off
    VirtualDocumentRoot /Users/matt/Sites/%0/docroot
    ServerName %0
    ServerAlias www.%0

In .htaccess:

RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]