Gossamer Forum
Quote Reply
GTMetrics
Did you already check GTs newest project GT Metrics?
I just tried to change my Expires Header with the following code, but GT Metrics shows no change in page loading time.
Is there something wrong with my .htaccess code

Code:
#Expire Header
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 30 days"
</FilesMatch>

Matthias
gpaed.de

Last edited by:

Matthias70: Feb 25, 2010, 11:57 AM
Quote Reply
Re: [Matthias70] GTMetrics In reply to
I've posted this on another forum and somebody replied with the following code to put in your .htaccess file. I haven't tried it yet so I don't know if it works.

Code:
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"

<FilesMatch "(?i)^.*\.(css|js)$">
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</FilesMatch>

<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
SetHandler None
FileETag MTime Size
Header unset Last-Modified
Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT"
Header set Cache-Control "public, no-transform"
</FilesMatch>
Quote Reply
Re: [MJB] GTMetrics In reply to
Upps, this code is a little bit longer ;-)
I will check it...
Thanks

Matthias
gpaed.de
Quote Reply
Re: [MJB] GTMetrics In reply to
O.K. this code is working fine, thanks.
But I don't like things in my htaccess file, that I don't really understand...

In the second part of your code, there are some difficult parts

Code:
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
SetHandler None
FileETag MTime Size <<< I would like to use ETag None, do you know what I have to change???
Header unset Last-Modified
Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT" <<< Why is there another Header set expires???
Header set Cache-Control "public, no-transform"
</FilesMatch>

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] GTMetrics In reply to
Quote:
I would like to use ETag None, do you know what I have to change???

Turn off ETags: http://www.askapache.com/...che-speed-etags.html

On this page it displays FileETag None

Quote:
Why is there another Header set expires???

Another? Where is the first one? I can't see it in the code.

If I've missed something here then it might be that it's relevant to a different set of file types but that's only an assumption.