Current time: 01-17-2021, 11:51 PM Hello There, Guest! (LoginRegister)

Post Reply 
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enable browser caching of static assets
09-13-2010, 02:28 AM (This post was last modified: 09-13-2010 02:30 AM by jabubo.)
Post: #2
RE: Enable browser caching of static assets
Try to add something like this, to an .htaccess file in the root-Folder of your website.

The settings add the expire header for the mime-types (Javascript, CSS, png, jpg and so on) beginning at the time the client access the file and adding the time specified as expiration time.
In the code below A604800, stands for accesstime + 604800 seconds is the expiration time.

In this time the client do not request the content again. Unless the client uses a local cache.

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType application/javascript A604800
ExpiresByType application/x-javascript A604800
ExpiresByType text/javascript A604800
ExpiresByType text/css A604800
ExpiresByType image/gif A604800
ExpiresByType image/x-icon A604800
ExpiresByType image/icon A604800
ExpiresByType image/jpg A604800
ExpiresByType image/jpeg A604800
ExpiresByType image/png A604800

Just check the HTTP-Header of any file mathing this. If the expire-header is not used, your provider has not enabled mod_expires for the Apache webserver. Ask him to do that.

test and execute PHP functions online free and easy =>
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Enable browser caching of static assets - jabubo - 09-13-2010 02:28 AM

Forum Jump:

User(s) browsing this thread: 1 Guest(s)