Link to home
Start Free TrialLog in
Avatar of Eddie Shipman
Eddie ShipmanFlag for United States of America

asked on

[.htaccess] Help adusting gZip and Expires values...

YSlow report says:
Grade F on Compress components with gzip

There are 12 plain text components that should be sent compressed
    http://www.mysite.com/css/c/style
    http://www.mysite.com/css/c/dd.css
    http://www.mysite.com/css/c/jqueryslidemenu.css
    http://www.mysite.com/assets/js/browser-detection.css
    http://www.mysite.com/assets/js/jquery-1.6.min.js
    http://www.mysite.com/assets/js/jquery.dd.js
    http://www.mysite.com/images/jquery.pngFix.pack.js
    http://www.mysite.com/assets/js/jqueryslidemenu.js
    http://www.mysite.com/assets/js/browser-detection.js
    http://www.mysite.com/assets/js/cufon-yui.js
    http://www.mysite.com/assets/js/Futura_Bk_BT_400.font.js
    http://www.mysite.com/store/ajax/getpubs.php

Open in new window


There are 32 static components without a far-future expiration date.
    (2012/2/17) http://www.mysite.com/css/c/style
    (2012/2/17) http://www.mysite.com/css/c/dd.css
    (2012/2/17) http://www.mysite.com/css/c/jqueryslidemenu.css
    (no expires) http://www.mysite.com/assets/js/browser-detection.css
    (2012/2/15) http://www.google-analytics.com/ga.js
    (no expires) http://www.mysite.com/assets/js/jquery-1.6.min.js
    (1997/7/26) http://www.mysite.com/j/banner_slides
    (1997/7/26) http://www.mysite.com/j/multi-click-slider
    (no expires) http://www.mysite.com/assets/js/jquery.dd.js
    (no expires) http://www.mysite.com/images/jquery.pngFix.pack.js
    (no expires) http://www.mysite.com/assets/js/jqueryslidemenu.js
    (no expires) http://www.mysite.com/assets/js/browser-detection.js
    (no expires) http://www.mysite.com/assets/js/cufon-yui.js
    (no expires) http://www.mysite.com/assets/js/Futura_Bk_BT_400.font.js
    (no expires) http://www.mysite.com/assets/js/fonts.js
    (1997/7/26) http://www.mysite.com/j/jquerycourseslide.js
    (no expires) http://www.mysite.com/images/menu_bg.png
    (no expires) http://www.mysite.com/images/menuArrowYellow.png
    (no expires) http://www.mysite.com/images/menuArrowGrey.png
    (no expires) http://www.mysite.com/images/bgHomeBanner.png
    (no expires) http://www.mysite.com/images/btnHomeBannerLeft.png
    (no expires) http://www.mysite.com/images/btnHomeBannerRight.png
    (no expires) http://www.mysite.com/images/btnLeft.png
    (no expires) http://www.mysite.com/images/btnRight.png
    (no expires) http://www.mysite.com/images/select-base.png
    (no expires) http://www.mysite.com/images/select-cap.png
    (no expires) http://www.mysite.com/images/iconComments.png
    (no expires) http://www.mysite.com/images/bgRSS.png
    (no expires) http://www.mysite.com/images/bgFooter.png
    (no expires) http://www.mysite.com/files/Subscriptionad4.jpg
    (no expires) http://www.mysite.com/images/favicon.ico
    (2000/4/19) http://www.google-analytics.com/__utm.gif?...

Open in new window

I have this added to my .htaccess:
<IfModule mod_headers.c>
Header unset ETag
Header unset Last-Modified
</IfModule>
FileETag None

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE 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
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</IfModule>

<Files *.php>
SetOutputFilter DEFLATE
</Files>

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
</IfModule>

Open in new window

What adjustments need to be made in order to avoid the reports above?

Note: These are links served by ExpresssionEngine as templates with no extension:
http://www.mysite.com/css/c/style
http://www.mysite.com/j/banner_slides
http://www.mysite.com/j/multi-click-slider

ExpressionEngine gZip output is set to Yes.
ASKER CERTIFIED SOLUTION
Avatar of Sudaraka Wijesinghe
Sudaraka Wijesinghe
Flag of Sri Lanka image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eddie Shipman

ASKER

1. I don't want to modify ever script I have with the ob_start function call.
2. I looks like my expires and gzip modules aren't enabled.
1. If you have a common script that you include in every page, you can (and should) use that to set the ob_start. If not, you still can include .php extension in the .htaccess code I mentioned above.

2. I'm afraid you will need to get those modules installed/enabled for this to work.