Skip to content

Instantly share code, notes, and snippets.

@voxpelli
Created April 2, 2010 16:42
Show Gist options
  • Save voxpelli/353353 to your computer and use it in GitHub Desktop.
Save voxpelli/353353 to your computer and use it in GitHub Desktop.
# Dynamic Virtual Hosts
# get the server name from the Host: header
UseCanonicalName Off
# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /home/foobar/sites/%-2.0.%-1.0/public_html
# Activate mod_rewrite - which is not recommended!
<Directory /home/foobar/sites/>
AllowOverride FileInfo
</Directory>
# Remove "www." from domain names
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*) %{HTTP_HOST}`$1 [C]
RewriteRule ^www\.([^\_]*)\`(.*)$ http://$1$2 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment