View Single Post
Old 23rd January 2009, 20:44
Miguel Miguel is offline
HowtoForge Supporter
Join Date: Sep 2007
Location: Maasmechelen - Belgium
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts

You could try putting it in rewrite.conf, but I never did.

To do so you need to disable rewrite and re-enable rewrite to enable the .conf file.

First of course write the .conf file. For ubuntu/debian it should be in /etc/apache2/mods-available/rewrite.conf

RewriteEngine On
RewriteBase /
# Rewrite foo subdomain requests to foo subdirectory
RewriteCond %{HTTP_HOST} ^squirrel\.domain1\.tld
RewriteCond %{HTTP_HOST} ^squirrel\.domain2\.tld
RewriteCond %{HTTP_HOST} ^squirrel\.domain3\.tld
RewriteCond %{REQUEST_URI} !^/squirrel/
RewriteRule (.*) /squirrel/$1 [L]

Given that the subdirectory has the same name for all domains this might work.

You can of course put it in the apache vhost conf of each domain. Than you don't need to put it in the .htaccess, but in each apache vhost configuration.

My best bet is to still put it in the root folder of each site to make it work.
Reply With Quote