Skip to content

Instantly share code, notes, and snippets.

@samnabi
Created December 11, 2015 17:39
Show Gist options
  • Save samnabi/419c1ecbe7ef75a869b2 to your computer and use it in GitHub Desktop.
Save samnabi/419c1ecbe7ef75a869b2 to your computer and use it in GitHub Desktop.
Shopzest rewrite rules
RewriteEngine On
RewriteBase /
# http://shopzest.com => https://shopzest.com
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^shopzest\.com
RewriteRule ^(.*)$ https://shopzest.com/$1 [R=301,L]
# http://www.shopzest.com => https://shopzest.com
# https://www.shopzest.com => https://shopzest.com
RewriteCond %{HTTP_HOST} ^www\.shopzest\.com
RewriteRule ^(.*)$ https://shopzest.com/$1 [R=301,L]
# https://subdomain.shopzest.com => http://subdomain.shopzest.com
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^(.+)\.shopzest\.com
RewriteRule ^(.*)$ http://%1.shopzest.com/$1 [R=301,L]
# https://www.subdomain.shopzest.com => http://subdomain.shopzest.com
# http://www.subdomain.shopzest.com => http://subdomain.shopzest.com
RewriteCond %{HTTP_HOST} ^www\.(.+)\.shopzest\.com
RewriteRule ^(.*)$ http://%1.shopzest.com/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment