Hi guys, I have been experimenting with google pagespeed plugin to enhance my modx Evo 1.0.4 frontend pages. After researching online I discovered a chunk of code to be included in .htaccess which sets content expiration (included below).
Could anyone recommend if this is adviseable to include, whilst using friendly URLs (meaning all dynamic pages have .html extension on the site).
I have originally set 7200 secs (2 hours) expires for .html pages, however this resulted in problems - anyone logging in as a Web User into frontend, was not able to log out after logging in? I can only presume it is due to this change in htaccess, so I changed the default expiration to 1 sec and 1 sec for .html files as below.
Can anyone recomend any other changes or am I ok with things as they are in here?
Should i be dealing with this in a different manner?
#SET EXPIRES HEADERS
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "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"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType application/xhtml+xml "access plus 7200 seconds"
</IfModule>
<ifModule mod_headers.c>
<filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\\.(css)$">
Header set Cache-Control "max-age=604800, public"
</filesMatch>
<filesMatch "\\.(js)$">
Header set Cache-Control "max-age=216000, private"
</filesMatch>
<filesMatch "\\.(xml|txt)$">
Header set Cache-Control "max-age=216000, public, must-revalidate"
</filesMatch>
<filesMatch "\\.(html|htm|php)$">
Header set Cache-Control "max-age=1, private, must-revalidate"
</filesMatch>
</ifModule>
<ifModule mod_headers.c>
Header unset ETag
</ifModule>
FileETag None
<ifModule mod_headers.c>
Header unset Last-Modified
</ifModule>
Just to add - there still seem to be problems with this block of code - it causes a webuser not to be able to logout for some weird reason. I am using default login/logout snippets for webusers. It also seems to be intermittent - ie i’ve tried logging in and out without issues, however my coleague keeps reporting problems in IE browser.