Save the. How to set different caching times for different file types You can see in the above code that there are time periods like "1 year" or "1 month". These are associated with file types, as an example the above code states that a. If you want to change that and say you want your jpg images cached for a month you would simply replace "1 year" with "1 month". The values above are pretty optimized for most webpages and blogs. Alternate caching method for.
|Published (Last):||19 January 2007|
|PDF File Size:||19.24 Mb|
|ePub File Size:||16.89 Mb|
|Price:||Free* [*Free Regsitration Required]|
This makes your site faster to surf on the web. To remove the cache from your browser, your browser cache needs to be cleared. Basic code for setting expire dates for cache In order to add browser caching to your website, you will need to set the date for when the cache expires.
This streamlines the htaccess code. In the code below, the file types are listed in a row like jpg jpeg png gif js css swf ico woff mp3. Below is an example of the code to use. To specify the specific times for each individual file type, you will want to use the previous code example.
The following will explain the Directive types that are used for Cache-Control. The following table explains the difference between them. Caching directives Enables the Expires headers for the website. ExpiresByType Directive This defines the age of the cache header and the type of file to cache. ExpiresDefault Directive This sets the age of the cache for all documents other than those specified in the ExpiresByType for the site.
Caching Directive bases There are 3 base types the access, now, and modification type.
Caching Files in .htaccess with Expires
These configuration files usually called. IIS 7 and above uses a file called Web. The Web. This article describes the most common uses of the. Sample Application Configuration Files The following examples are two configuration files for a sample application: an. Sample Application. Options -Indexes Follow symbolic links in this directory.
How to Add mod_expires to your .htaccess
How can I cache my site with an .htaccess file?