Skip to content

Instantly share code, notes, and snippets.

@coreyweb
Created March 25, 2012 14:02
Show Gist options
  • Save coreyweb/2194845 to your computer and use it in GitHub Desktop.
Save coreyweb/2194845 to your computer and use it in GitHub Desktop.
Force www (mod rewrite)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain-name\.com
RewriteCond %{HTTPS} =on
RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{HTTP_HOST} ^domain-name\.com
RewriteCond %{HTTPS} !=on
RewriteRule .* http://www.%{SERVER_NAME}%{REQUEST_URI} [R,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment