Created
December 19, 2014 15:10
-
-
Save h3xxx/4b8dc1526d605966430a to your computer and use it in GitHub Desktop.
Apache2 subdomains (different ports) redirection
This file contains hidden or 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
### from http://serverfault.com/questions/195611/how-do-i-redirect-subdomains-to-a-different-port-on-the-same-server | |
NameVirtualHost *:80 | |
<VirtualHost *> | |
ServerAdmin [email protected] | |
ServerName dev.mydomain.com | |
ProxyPreserveHost On | |
# setup the proxy | |
<Proxy *> | |
Order allow,deny | |
Allow from all | |
</Proxy> | |
ProxyPass / http://localhost:8888/ | |
ProxyPassReverse / http://localhost:8888/ | |
</VirtualHost> | |
###--------------------------------- | |
NameVirtualHost *:80 | |
<VirtualHost *:80> | |
ServerName dev.mydomain.com | |
redirect / http://mydomain.com:8080/ | |
</VirtualHost> | |
###--------------------------------- | |
ProxyPreserveHost On | |
ProxyPass / http://example.com:8080/ | |
ProxyPassReverse / http://example:8080/ | |
###--------------------------------- | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^dev\.example\.com$ [NC] | |
RewriteRule ^(.*)$ http://example.com:8080$1 [R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment