Skip to content

Instantly share code, notes, and snippets.

@saml
Forked from John2496/gist:a68ee6c7099734e1ffa7
Last active August 29, 2015 14:07
Show Gist options
  • Save saml/35a09b1018db236be6b1 to your computer and use it in GitHub Desktop.
Save saml/35a09b1018db236be6b1 to your computer and use it in GitHub Desktop.
<VirtualHost *:80>
RewriteEngine On
RewriteMap lowercase int:tolower
# if already rewitten and we have the right path, stop right here
#RewriteCond /var/www/vhosts/${lowercase:%{SERVER_NAME}/htdocs} !-d
#RewriteRule ^/(.*)$ /var/www/vhosts/_default/htdocs/$1 [L,E=VHOST_ROOT:/var/www/vhosts/_default/htdocs]
RewriteRule ^(/var/www/vhosts/[^/]+/.*)$ $1
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1
##RewriteRule ^(.*).dev.(.*) $1.$2
RewriteRule ^(.*)dev.(.*) $1$2
RewriteRule ^(.*).dev(.*) $1$2
RewriteRule ^(www\.)?([^/]+)/(.*)$ /var/www/vhosts/$2/htdocs/$3 [E=VHOST_ROOT:/var/www/vhosts/$2/]
Options +Indexes +FollowSymLinks
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment