Skip to content

Instantly share code, notes, and snippets.

@amercier
Created November 2, 2013 10:01
Show Gist options
  • Save amercier/7277367 to your computer and use it in GitHub Desktop.
Save amercier/7277367 to your computer and use it in GitHub Desktop.
RewriteEngine on
# Forbid using IP address
#Rewritecond %{HTTP_HOST} ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$
#Rewriterule ^(.*)$ - [F]
# Forbid other domains
Rewritecond %{HTTP_HOST} !amercier\.com [NC]
RewriteRule ^ - [F]
# Redirect to port 6780 on freebox.amercier.com
Rewritecond %{HTTP_HOST} ^freebox\.amercier\.com [NC]
Rewriterule ^ http://%{HTTP_HOST}:6780%{REQUEST_URI} [QSA,L,R=301]
# Redirect http://* to https://*
RewriteCond %{HTTPS} !on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301]
# Redirect to port 6701 on home.amercier.com
Rewritecond %{HTTP_HOST} ^home\.amercier\.com [NC]
Rewriterule ^ https://%{HTTP_HOST}:6701%{REQUEST_URI} [QSA,L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment