preformance wise htaccess
Posted
by
purpler
on Server Fault
See other posts from Server Fault
or by purpler
Published on 2010-12-22T07:54:16Z
Indexed on
2010/12/22
7:55 UTC
Read the original article
Hit count: 340
hese's the my htaccess template, i wonder if anything could be added to increase website performance..
# Defaults
AddDefaultCharset UTF-8
DefaultLanguage en-US
ServerSignature Off
FileETag None
Header unset ETag
Options -MultiViews
#Options All -Indexes
# Force the latest IE version or ChromeFrame
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
</IfModule>
</IfModule>
# Proxy X-UA Setup
<IfModule mod_headers.c>
Header append Vary User-Agent
</IfModule>
#Rewrites
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
# Redirect to non-WWW
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Redirect to WWW
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
# Redirect index to root
RewriteRule ^(.*)index\.(php|html)$ /$1 [R=301,L]
# Caching
ExpiresActive On
ExpiresDefault A0
Header set Cache-Control "public"
# 1 Year Long Cache
<FilesMatch "\.(flv|fla|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|png|jpg|jpeg|gif|swf|js|css|ttf|eot|woff|svg|svgz)$">
ExpiresDefault A31622400
</FilesMatch>
# Proxy Caching
<FilesMatch "\.(css|js|png)$">
ExpiresDefault A31622400
Header set Cache-Control "private"
</FilesMatch>
# Protect against DOS attacks by limiting file upload size
LimitRequestBody 10240000
# Proper SVG serving
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
# GZip Compression
<IfModule mod_deflate.c>
<FilesMatch "\.(php|html|css|js|xml|txt|ttf|otf|eot|svg)$" >
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
# Error page
ErrorDocument 404 /404.html
# Deny access to sensitive files
<FilesMatch "\.(htaccess|ini|log|psd)$">
Order Allow,Deny
Deny from all
</FilesMatch>
© Server Fault or respective owner