Created
November 8, 2010 18:21
-
-
Save armitage/668026 to your computer and use it in GitHub Desktop.
This Apache Config takes the subdomain part of a url if available (except www) and tries to find files in the document root with subdomain appended if the file cannot be found their i tries a second directory, in thies case the top level doc root
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteLogLevel 2 | |
RewriteLog /var/www/sites/camino_surf/logs/rewrite.log | |
RewriteCond %{HTTP_HOST} !www.caminosurf.com$ [NC] | |
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).caminosurf.com [NC] | |
# first try to find it in branch dir based on subdomain | |
# ...and if found stop and be happy: | |
RewriteCond /var/www/sites/camino_surf/public/%{REQUEST_FILENAME} -f | |
RewriteRule ^(.+) /var/www/sites/camino_surf/public/%2/$1 [L] | |
# second try to find it in toplevel public content | |
# ...and if found stop and be happy: | |
RewriteCond /var/www/sites/camino_surf/public/%{REQUEST_FILENAME} -f | |
RewriteRule ^(.+) /var/www/sites/camino_surf/public/$1 [L] | |
# else go on for other Alias or ScriptAlias directives, | |
# etc. | |
RewriteRule ^(.+) - [PT] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment