Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tott
Created December 3, 2013 10:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tott/7767218 to your computer and use it in GitHub Desktop.
Save tott/7767218 to your computer and use it in GitHub Desktop.
.htaccess rule to force www and preserving the protocol http/https
# Force www
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment