Skip to content

Instantly share code, notes, and snippets.

@lyonsun
Created November 21, 2013 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyonsun/7574770 to your computer and use it in GitHub Desktop.
Save lyonsun/7574770 to your computer and use it in GitHub Desktop.
force ssl connection. .htaccess setting.
RewriteEngine On
RewriteCond %{HTTPS} =off [OR]
RewriteCond %{HTTP_HOST} !^www\. [OR]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(html|php)
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)$
RewriteRule ^(index\.(html|php))|(.*)$ https://www.%2/$3 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment