Created
January 18, 2019 23:53
-
-
Save sunuazizrahayu/cd33dd7ef6506164799f96b4d2a51d6a to your computer and use it in GitHub Desktop.
Force https://www on Codeigniter with .htaccess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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