Skip to content

Instantly share code, notes, and snippets.

@sanPuerquitoProgramador
Created June 12, 2017 19:16
Show Gist options
  • Save sanPuerquitoProgramador/ca4c6e36393023d3206aca4a7228bbbc to your computer and use it in GitHub Desktop.
Save sanPuerquitoProgramador/ca4c6e36393023d3206aca4a7228bbbc to your computer and use it in GitHub Desktop.
htaccess for CodeIngniter projects
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
#In this point you don´t need anymore. The next lines are just for optimice the assets cache
#leave this only if you have mod_expires working on your server and you need clear assets cache from time to time
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 10 days"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/plain "access plus 1 week"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/x-icon "access plus 3 months"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/x-icon "access plus 3 months"
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment