Last active
December 17, 2015 20:29
-
-
Save seaders/5668016 to your computer and use it in GitHub Desktop.
Way to redirect a subdomain other than 'www' to a subdirectory with Apache. Apache mods enabled are 'headers', 'proxy', 'proxy_http' and 'rewrite'.
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
<VirtualHost *:80> | |
ServerName www.sixminute.com | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^www\.sixminute\.com [NC] | |
RewriteCond %{HTTP_HOST} ^(.*?)\.?sixminute\.com$ | |
RewriteRule ^/(.*) http://www.sixminute.com/%1/$1 [P] | |
ProxyPassReverse / http://www.sixminute.com/%1/ | |
SetEnvIf Origin "http(s)?://(www\.)?sixminute.com$" AccessControlAllowOrigin=$0sixminute.com | |
Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment