Sun March 20, 2011 12:56 am
Filed Under: Web Development
0 Comment(s) | Add
ExpressionEngine .htaccess
Kevin Thompson had a nice post on his blog about completely removing index.php from ExpressionEngine URL’s, which was shamelessly stolen and included here; please take a look at the discussion there for rationale, should you need any.
Otherwise, I’ve added couple of other items, namely enabling Gzip compression and preventing folks from viewing the contents of directories without index files.
# Enable Rewrite Engine
#———————————————
RewriteEngine on
RewriteBase /
# Redirect index.php Requests
#———————————————
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{THE_REQUEST} !/system/.*
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]
# Standard ExpressionEngine Rewrite
#———————————————
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
# Hide folder/directory/index file lists
#———————————————
Options -Indexes
# Compress JS/HTML/Text with GZip
#———————————————
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html















