Make Browsers Cache Static Files With mod_expires On Apache2 (Debian Squeeze) This tutorial explains how you can configure Apache2 to set the Exp. Enable it with “a2enmod expires” if you’re using Ubuntu or Debian – afterwards restart Apache): mod_expires.c> ExpiresActive on. It might be as simple as missing one keyword that is causing your issue. ## EXPIRES CACHING ## mod_expires.c> ExpiresActive On ExpiresByType.

Author: Gara Vugar
Country: Nicaragua
Language: English (Spanish)
Genre: Health and Food
Published (Last): 28 February 2018
Pages: 492
PDF File Size: 5.5 Mb
ePub File Size: 13.9 Mb
ISBN: 511-5-99242-827-6
Downloads: 27517
Price: Free* [*Free Regsitration Required]
Uploader: Goltimi

How to Add mod_expires to your .htaccess

Added this to my. Please let us know if you have any further questions or comments. You might have noticed that I’ve set three ExpiresByType directives for Javascript files – that is because Javascript files might have different file types on each server.

Kindest Regards, Scott M Reply.

Share it with others to increase its visibility and to get it answered quickly. That is not normal behavior, so it seems like it’s either expkresbytype with your code or your server that is causing this. Yes, my password is: The way it should work, is browsers who have already cached the files will wait until the expiration date set in the headers before checking back.

I added the Basic expire code from this tutorial to my htaccess file and the GTMetrix Report is still saying “F” fail on that issue I have GT metrix saying: We also tried W3 PlugIn but apace the same result. Some CMS systems create these files on demand. If you really want to get them off of gtmetrix report, then remove the dependencies from your website.

Then you have control over the files, and caching, etc. Then i modifed the file again today then accessed for 2nd time but it didnt show me the modified content because proxy serves the file from cache. I understood that if the file cached in proxy then we need to clear from prxy end.


Allow public access to a file in a protected directory using. For example, if you have a file javascript. Add any required rules to the. When I add the mod expires lines I get a error but if I remove it everything works fine Opinions on best use may have changed and the expiresytype may need to be reviewed.

Allow access to specific file types in a protected directory a;ache, hits. There are 6 static components without a far-future expiration date. Enabling the expire module also wont work till the expire time set by the Heuristic expiration policies expires.

There is also some configurations for various web servers see here.

Using Apache mod_expires to control browser caching

How to Change Your Default Timezone in. How to Change your Default Index Page in. This tutorial explains how you can configure Apache2 to set the Expires HTTP header and the max-age directive of the Cache-Control HTTP header of static files such as images, CSS and Javascript files to a date in the future so that these files will be cached by your visitors’ browsers.

Seems to work just fine with both but always best practice to have proper syntax. Hello Alam, Sorry to hear you’re having problems with the headers. Thanks again, JF Reply. It is an excellent article and very helpful. Be sure to fully clear all temporary data in your browser.

Ilmari Karonen 7, 1 16 Alternatively you could only whitelist your subdomains like “subdomain. What to do here?

In the Live HTTP Headers output, you should now see an Expires header and a Cache-Control header with a max-age directive max-age contains a value in seconds, for example is one week in the future:. Adam MacDonald 1, 12 Click to Chat Now E-mail: Chetabahana 3, 1 18 Is the information out of date or inaccurate? The following table explains the difference between them.


In what area to look for? What are expires headers. By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy exppiresbytype and cookie policyand that your continued use of the website is subject to these policies.

Is the code changed to adding expire dates to the headers? Then i modifed again and accessed, this time it worked, I can able to see the modified content. If we access an old last modified file for the first time, Heuristic expiration policies set a expire time by deafult. How to Force www or non-www in htaccesshits. Hello Prasana, Thank you for your question.

I personally have a system in place for websites where I use these rules so that whenever changes are made to the Javascript or CSS files they are given unique names – see my ” Force reload of updated CSS and Javascript files with unique filenames ” for an example of how this can be accomplished without having to rename the files each time.

I gather there might not be a good solution to this one It does appear that you may have some server side caching issues that you may want to speak with your server admin about. Thank you, -John-Paul Reply.

How to setup expire headers on Apache? | DigitalOcean

One of the very few articles on the subject that explains concepts with enought detail. This makes your site faster to surf on the web. Because it has attracted low-quality or spam answers that had to be removed, posting an answer apacche requires 10 reputation on this site the association bonus does not count.