Skip to content

Commit

Permalink
Enable gzip compression for favicons. Closes h5bp#684.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Aug 14, 2011
1 parent c86f2b5 commit b44a12d
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html

Expand Down Expand Up @@ -38,7 +39,7 @@
# Cross-domain AJAX requests
# ----------------------------------------------------------------------

# Serve cross-domain ajax requests, disabled.
# Serve cross-domain ajax requests, disabled.
# enable-cors.org
# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity

Expand Down Expand Up @@ -70,7 +71,7 @@


# JavaScript
# Normalize to standard type (it's sniffed in IE anyways)
# Normalize to standard type (it's sniffed in IE anyways)
# tools.ietf.org/html/rfc4329#section-7.2
AddType application/javascript js

Expand All @@ -86,16 +87,16 @@ AddType video/webm webm
# SVG.
# Required for svg webfonts on iPad
# twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svg svgz
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
# Webfonts

# Webfonts
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf ttc
AddType font/opentype otf
AddType application/x-font-woff woff

# Assorted types
# Assorted types
AddType image/x-icon ico
AddType image/webp webp
AddType text/cache-manifest appcache manifest
Expand All @@ -108,7 +109,7 @@ AddType text/x-vcard vcf


# ----------------------------------------------------------------------
# Allow concatenation from within specific js and css files
# Allow concatenation from within specific js and css files
# ----------------------------------------------------------------------

# e.g. Inside of script.combined.js you could have
Expand Down Expand Up @@ -163,6 +164,7 @@ AddType text/x-vcard vcf
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
FilterChain COMPRESS
Expand All @@ -175,7 +177,7 @@ AddType text/x-vcard vcf
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
</IfModule>
</IfModule>

Expand All @@ -188,7 +190,7 @@ AddType text/x-vcard vcf
# These are pretty far-future expires headers.
# They assume you control versioning with cachebusting query params like
# <script src="application.js?20100608">
# Additionally, consider that outdated proxies may miscache
# Additionally, consider that outdated proxies may miscache
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

# If you don't use filenames to version, lower the CSS and JS to something like
Expand All @@ -203,9 +205,9 @@ AddType text/x-vcard vcf
# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest "access plus 0 seconds"

# Your document html
# Your document html
ExpiresByType text/html "access plus 0 seconds"

# Data
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
Expand All @@ -216,7 +218,7 @@ AddType text/x-vcard vcf
ExpiresByType application/atom+xml "access plus 1 hour"

# Favicon (cannot be renamed)
ExpiresByType image/x-icon "access plus 1 week"
ExpiresByType image/x-icon "access plus 1 week"

# Media: images, video, audio
ExpiresByType image/gif "access plus 1 month"
Expand All @@ -227,25 +229,25 @@ AddType text/x-vcard vcf
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"

# HTC files (css3pie)
ExpiresByType text/x-component "access plus 1 month"

# Webfonts
ExpiresByType font/truetype "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"

# CSS and JavaScript
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"

<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>

</IfModule>


Expand Down Expand Up @@ -328,7 +330,7 @@ FileETag None
# ----------------------------------------------------------------------

# Option 1:
# Rewrite "www.example.com -> example.com"
# Rewrite "www.example.com -> example.com"

<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
Expand Down Expand Up @@ -370,12 +372,12 @@ FileETag None
# </IfModule>



# ----------------------------------------------------------------------
# Prevent SSL cert warnings
# ----------------------------------------------------------------------

# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
# https://www.example.com when your cert only allows https://secure.example.com
# Uncomment the following lines to use this feature.

Expand All @@ -390,10 +392,10 @@ FileETag None
# Prevent 404 errors for non-existing redirected folders
# ----------------------------------------------------------------------

# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist
# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist
# e.g. /blog/hello : webmasterworld.com/apache/3808792.htm

Options -MultiViews
Options -MultiViews



Expand Down

0 comments on commit b44a12d

Please sign in to comment.