Skip to content

Instantly share code, notes, and snippets.

@sunuazizrahayu
Created January 18, 2019 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sunuazizrahayu/cd33dd7ef6506164799f96b4d2a51d6a to your computer and use it in GitHub Desktop.
Save sunuazizrahayu/cd33dd7ef6506164799f96b4d2a51d6a to your computer and use it in GitHub Desktop.
Force https://www on Codeigniter with .htaccess
RewriteEngine on
#Force WWW
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond $1 !^(index\.php|resources|robots\.txt|public)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment