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: Zulkizragore Voodoolrajas
Country: Oman
Language: English (Spanish)
Genre: Politics
Published (Last): 21 August 2008
Pages: 478
PDF File Size: 4.40 Mb
ePub File Size: 17.32 Mb
ISBN: 447-5-69077-804-8
Downloads: 90383
Price: Free* [*Free Regsitration Required]
Uploader: Mezikazahn

On a Debian based system e. It is an excellent article and very helpful.

To simplify my question This expire configuration works for the file which is not accessed and cached before in proxyWhat configuration we can do for the file which is already accesed and cached in the proxy and having a expiration date. I used like 3 different WP plugins but none of them worked so expirebsytype You will need to have the proxy server files cleared.

Opinions on best use may have changed and the article may need to be reviewed. Can anyone please let us know how to fix this problem. This allows the viewer to see the webpage faster since the file is “cached” and they don’t have to load a new copy of it. I am telling you here what exactly happening. Each file type can be set to specific times to expire the cache.

php – Leverage browser caching, how on apache or .htaccess? – Stack Overflow

If those links are static and don’t change, then you most likely don’t have to worry about it. I hope that helps to answer your question!


They discuss the same problem and have possible solutions apachee you. But i want to know how to solve the same for the old files also. I last modifed a file name sample. Do I mess or change the Apache config file below or do I put something in my. If changes to a file are required then the filename must be changed to avoid caching issues, so be sure to set rules carefully.

Any suggestion for this? That is not normal behavior, so it seems like it’s either something with your code or your server that is causing this. If i wait till the already defined expiration date expired then after that everything works normal and the modification are relfecting as soon as we change from server end. Your suggestion gave me solution for my current issue, Thank you so much for that.

Is the guide complete? Read my ” Content-type for Javascript with Apache ” post for some more details about this. Thanks again, Chris Reply.

In the code below, the file types are listed in a row like jpg jpeg png gif js css swf ico woff mp3. InMotion Hosting Customer Community. If no expire module enabled then again a new expire date is set by the Heuristic expiration policies.

Was this article helpful? Thank you very much!

Using Apache mod_expires to control browser caching

I have GT metrix saying: By doing this with the expires rules I am able to get the browsers to do a high level of caching but still have them get fresh files if and when I need them to. Please answer the follwing questions to help us improve this article. Leave a Comment Add comments here to get more clarity or context around a question.


Gtmetrix is taking a profile of your site by seeing EVERY element that is loading or requries time to load on an internet browser.

How to Add mod_expires to your .htaccess

Share it with others to increase its visibility and to get it answered quickly. I hope this helps to answer your question, please let us know if you require any further assistance. W3TC Caching plugin tries to set the expiry expiresybtype for files on a web page so that they don’t have to be loaded repeatedly.

I understood that if the file cached in proxy then we need to clear from prxy end. I’ve head it can be something wrong in my httpd. Seems to work just fine with both but always best practice to have proper syntax. 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.

Do you already have an account? If you have any further questions or comments, please let us know. Sign into your account, or create a new one, to start interacting. Alternatively you could only whitelist your subdomains like “subdomain.