Created
July 15, 2010 22:12
-
-
Save unruthless/477608 to your computer and use it in GitHub Desktop.
.htaccess file in use on an EE website with HTML5 markup and versioned static assets.
This file contains 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
# === ENABLE mod_rewrite ========================================= | |
RewriteEngine on | |
# === SECURITY TWEAKS ============================================ | |
# --- Stop malicious visitors from viewing ------- | |
# --- your .htaccess rules in the browser. ------- | |
<Files .htaccess> | |
order allow,deny | |
deny from all | |
</Files> | |
# === PERFORMANCE TWEAKS ========================================= | |
# --- Set far future Expires header -------------- | |
<FilesMatch "\.(gif|png|jpg|js|css|swf)$"> | |
ExpiresActive On | |
ExpiresDefault "access plus 10 years" | |
</FilesMatch> | |
# --- Disable ETags ------------------------------ | |
Header unset ETag | |
FileETag None | |
# --- Serve font files gzipped ------------------- | |
Addtype font/otf .otf | |
Addtype font/eot .eot | |
Addtype font/woff .woff | |
Addtype font/ttf .ttf | |
Addtype font/svg .svg | |
AddOutputFilterByType DEFLATE font/otf font/eot font/woff font/ttf font/svg | |
Header append Vary Accept-Encoding | |
# --- Rewrite versioned static images ------------ | |
RewriteRule ^(images/site_image_assets/)(.+)\.(.+)\.(jpg|gif|png)$ $1/$2.$4 [L] | |
# --- Serving your HTML as HTML5? ---------------- | |
# --- Take care of FF2 and older Gecko-based ----- | |
# --- browsers that get confused ----------------- | |
RewriteCond %{REQUEST_URI} \.html$ | |
RewriteCond %{HTTP_USER_AGENT} rv:1\.(([1-8]|9pre|9a|9b[0-4])\.[0-9.]+).*Gecko | |
RewriteRule .* - [T=application/xhtml+xml] | |
# === EXPRESSIONENGINE TWEAKS ==================================== | |
# --- Remove index.php from URLs ----------------- | |
# --- Exclude List method ------------------------ | |
RewriteCond $1 !^(images|system|themes|favicon\.ico|robots\.txt|index\.php) [NC] | |
RewriteRule ^(.*)$ /index.php/$1 [L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment