- 
      
- 
        Save gwokudasam/157c76f06785e907e51a215330ee8d17 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