Skip to content

Instantly share code, notes, and snippets.

@John2496
Created October 16, 2014 21:40
Show Gist options
  • Save John2496/a68ee6c7099734e1ffa7 to your computer and use it in GitHub Desktop.
Save John2496/a68ee6c7099734e1ffa7 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