Last active
December 20, 2015 00:48
-
-
Save infolock/6044084 to your computer and use it in GitHub Desktop.
htaccess file containing Apache Mod Rewrite Rule(s) for doing a Subdomain Redirect (CloudFlare as the Nameserver, Godaddy As the host) The nginx conf file related to this htaccess file can be found here: https://gist.github.com/infolock/6044150 More information can be found in the full article: http://phpadvocate.com/blog/2013/07/apache-godaddy-…
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
# Author Jonathon Hibbard | |
##################### Godaddy Apache .htaccess for example.com ##################### | |
Options +FollowSymlinks | |
RewriteEngine On | |
RewriteBase / | |
##################### Try and prevent looping madness ##################### | |
RewriteCond %{ENV:REDIRECT_STATUS} 200 | |
RewriteRule .* - [L] | |
################################################################################# | |
# Determine if we should redirect to the external server | |
###### | |
# If there is not a subdomain provided and/or even www is missing, we redirect to the external server | |
RewriteCond %{HTTP_HOST} ^example\.com [NC] | |
RewriteCond %{HTTP_HOST} !^feeds\.example\.com [NC] | |
RewriteCond %{REQUEST_URI} !^/feeds/(.*) [NC] | |
# Perform the redirect if the evaluations above passed... | |
RewriteRule ^/(.*)$ http://images.example.com [L,R,NE] | |
################################################################################# | |
# Determine if the URL being processed is for the subdomain on this server (the godaddy server). | |
# If so, we'll just redirect them to the subdirectory there. | |
RewriteCond %{HTTP_HOST} ^feeds\.example\.com [NC] | |
RewriteCond %{REQUEST_URI} !^/feeds/(.*) [NC] | |
RewriteRule ^/(.*)$ feeds/$1 [L,R,NE] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment