Hi y'all.
This one is driving me nuts.
When I run my site http://scm.moodleace.com through this great site analyzer on: http://gtmetrix.com/
I get a score of 80% for YSlow and 82% for Google Speed Grades.
However, I get an 'F' score for the "Add Expires headers" section
of the analysis result page of gtmetrix.com for my site. Below is a snippet of the detailed report:
There are 12 static components without a far-future expiration date.
scm.moodleace.com/theme/anomaly_orange/styles.php
scm.moodleace.com/lib/javascript-mod.php
scm.moodleace.com/blocks/graph_stats/graph.php?course_id=1
scm.moodleace.com/file.php/1/icons/02f-eng.png
scm.moodleace.com/file.php/1/icons/01f-it.png
scm.moodleace.com/file.php/1/icons/03f-biz.png
scm.moodleace.com/file.php/1/icons/04f-hos.png
scm.moodleace.com/file.php/1/icons/08f-free.png
scm.moodleace.com/file.php/1/icons/09f-gam.png
scm.moodleace.com/user/pix.php/6/f2.jpg
scm.moodleace.com/file.php/1/icons/moodle20_f.png
scm.moodleace.com/file.php/1/icons/apture_effect_f.png
OKAY, so I set out to add far future expiration dates to these file types,
and so far I have failed spectacularly. Miserably. Desperately.
What did I do?
First, I checked that mod_expires was actually already installed on my Centos.
A quick linux command of httpd -M of revealed that it was installed.
So I merrily edited my /etc/httpd/conf/httpd.conf file by adding in this code:
# CONFIGURE media caching
#
Header unset ETag
FileETag None
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
ExpiresActive On
<FilesMatch "\.(ico|pdf|flv|jpe?g|png|gif|js|css|swf)$">
ExpiresDefault "access plus 1 year"
</FilesMatch>
After that, I restarted Apache with this code:
/etc/init.d/httpd restart
Lastly, I ran the site through this great site analyzer on Firefox:
http://gtmetrix.com/
AND I STILL GET AN 'F' GRADE FOR "Add Expires Headers". See attached jpg.
A few more details:
My Php version (running on Moodle 1.9.7) is 5.2.17. I don't have any .htaccess file in my root (/) directory. Oh yeah, I'm also
running eAccelerator on my site, mod_deflate and munin reports.
If I can get the far -future expiration date for my static files to work,
that would be almost perfect. I would be thrilled, ecstatic and over the moon.
This would bump my YSlow and Page Speed Grades up a couple of notches.
Can any kind soul on Moodle.org advise me - what am I not doing right???
Frankie Kam
Melaka, Malaysia