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.

Author:Gahn Shakataur
Language:English (Spanish)
Published (Last):13 March 2017
PDF File Size:13.46 Mb
ePub File Size:7.80 Mb
Price:Free* [*Free Regsitration Required]

Each time your website is accessed without Cache-Control, your website has to make a request to the server for each image, javascript file, CSS file, and so forth to load. Browser caching is good because it allows your web resources to be stored in the browser for faster page load time.

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 cache code is placed in the. You will need to edit your. Add the following code to the file and save it. In the previous code example, the jpg, jpeg, gif, png will expire in a year and pdf, javascript and flash files will expire in a month.

More explanation o these settings will come later in this article. This matches the file types to the specific expire time. 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.


Subscribe to RSS

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".


Leverage browser caching



Die ultimative WordPress .htaccess erstellen


Related Articles