-
-
Save smtir/dd5ee3dcacf021644b9b3b0d5950624b to your computer and use it in GitHub Desktop.
.htaccess for Codeigniter to avoid index.php and force www. before any URL
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
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteCond %{HTTP_HOST} !^$ | |
| # BEGIN force www before URL | |
| RewriteCond %{HTTP_HOST} !^www\. [NC] | |
| RewriteCond %{HTTPS}s ^on(s)| | |
| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
| # END for www on URL | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteRule ^(.*)$ ./index.php/$1 [L] | |
| </IfModule> | |
| <IfModule !mod_rewrite.c> | |
| ErrorDocument 404 index.php | |
| </IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment