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.
After expiring, a browser must refresh its version of the resource by sending another request to a server. For example, cache-control: max-age=120 means that the returned resource is valid for 120 seconds, after which the browser has to request a newer version.
By default, each file automatically expires after 24 hours, but you can change the default behavior in two ways: To change the cache duration for all files that match the same path pattern, you can change the CloudFront settings for Minimum TTL, Maximum TTL, and Default TTL for a cache behavior.
Is cached data important? Cached data isn't inherently important, as it's only considered “temporary storage.” However, it does exist to improve the user experience. On-page elements like images, videos, and even text take some time to load.
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:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With