Apache has a nifty mass vhost feature. Problem is, when I use this to reach my site, clean-urls stop working. Is there a way to combine this with clean urls?

<Directory /var/www/localhost/htdocs>
  Order allow,deny
  Allow from all
UseCanonicalName Off
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /tmp/access_log vcommon
VirtualDocumentRoot /var/www/localhost/htdocs/%0/web
VirtualScriptAlias /var/www/localhost/htdocs/%0/web

Obviously I've attempted to add

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

to the <Directory/>, but that doesn't help.

  • I'm aware this is borderline between the Drupal specific site, and Stackoverflow. I'm posting here, because I'm interested in how this works together with Drupals .htaccess, not any .htaccess. – Letharion Mar 6 '12 at 20:34

I had to add a slash before index.php to get this working for WordPress. Has to do with VirtualDocumentRoot not setting the DocumentRoot to the same value I guess.

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


Might want to checkout http://www.latenightpc.com/blog/archives/2007/09/05/a-couple-ways-to-debug-mod_rewrite

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.