php - .htaccess accounts for gzip encoding and caching but YSlow reports an 'F' on both -
i new optimization techniques such gzip compression , caching. after research on net, realized possible through .htaccess based on apache handlers. had enquired webhosting know if mod_deflate , mod_headers libraries present , available
i checked through firebug. shows request headers "accept-encoding gzip,deflate" there no "content-encoding" in response field. can please me out on going wrong?
following code of .htaccess file
options -indexes options +followsymlinks rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] <ifmodule mod_deflate.c> addoutputfilterbytype deflate application/x-javascript addoutputfilterbytype deflate text/css text/html text/plain text/xml deflatecompressionlevel 9 </ifmodule> # ---------------------------------------------------------------------- # expires headers (for better cache control) # ---------------------------------------------------------------------- # these pretty far-future expires headers. # assume control versioning filename-based cache busting # additionally, consider outdated proxies may miscache # www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ # if don't use filenames version, lower css , js # "access plus 1 week" or so. <ifmodule mod_expires.c> expiresactive on # perhaps better whitelist expires rules? perhaps. expiresdefault "access plus 1 month" # cache.appcache needs re-requests in ff 3.6 (thanks remy ~introducing html5) expiresbytype text/cache-manifest "access plus 0 seconds" # document html expiresbytype text/html "access plus 0 seconds" # data expiresbytype text/xml "access plus 0 seconds" expiresbytype application/xml "access plus 0 seconds" expiresbytype application/json "access plus 0 seconds" # feed expiresbytype application/rss+xml "access plus 1 hour" expiresbytype application/atom+xml "access plus 1 hour" # favicon (cannot renamed) expiresbytype image/x-icon "access plus 1 week" # media: images, video, audio expiresbytype image/gif "access plus 1 month" expiresbytype image/png "access plus 1 month" expiresbytype image/jpg "access plus 1 month" expiresbytype image/jpeg "access plus 1 month" expiresbytype video/ogg "access plus 1 month" 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 application/x-font-ttf "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 , javascript expiresbytype text/css "access plus 1 year" expiresbytype application/javascript "access plus 1 year" </ifmodule>
are sure host provider has both modules enabled? have checked website hosted in same provider? small host providers turn off mod_deflate on shared plans save cpu therefore increase sharing.
trying curl js resource on site, e.g.:
curl -i "http://yslow.org/yslow-bookmarklet.js" -h "accept-encoding: gzip, deflate" you should like:
http/1.1 200 ok server: nginx/1.0.13 date: wed, 06 jun 2012 18:31:25 gmt content-type: application/x-javascript last-modified: fri, 25 may 2012 16:11:28 gmt connection: keep-alive expires: thu, 07 jun 2012 18:31:25 gmt cache-control: max-age=86400 content-encoding: gzip look content-encoding make sure mod_deflate on , expires , cache-control mod_expires.
Comments
Post a Comment