I have a php site using html5 run on a linux server on godaddy. I need to set a cache expiration date on static images and a css file. I also need to gzip a css file and cannot seem to find the correct syntax for either. I am not sure if I am making this too complicated or what. Am I correct to think I can get this done with an expire header in the top of my php pages? I feel lost and I know what i am doing! I do not have control over the server.
+2
A:
This is definitely possible if you have control over the server, and maybe possible through .htaccess if you're on shared hosting.
Try these SO questions:
Pekka
2010-01-19 22:37:02
A:
You can tray this
<FilesMatch "\.(jpg|png|gif)$">
ExpiresDefault A0
Header set Cache-Control "max-age=0, no-cache, must-revalidate"
</FilesMatch>
Which mean, that expiration date is in access moment and set headers to 0 values.
As You can see, here You can add more filetypes
Umbrovskis.com
2010-02-10 08:40:49
A:
Godaddy can be extremely frustrating. I have been seeking a means of using expires header with Godaddy hosting for some time and haven't found a solution yet.
I have the following in htaccess ('A2592000' indicates 1 month) and it works with other hosts but not Godaddy :(
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
Gary
2010-07-02 05:33:55