
Wordpress blog generally, designed with a lot of images and hence increases page load time at client side. And it is really annoying for your daily visitors as on every visit they make, experience high page load time. But, this problem was resolved lately when, cache feature was updated in the browsers. So, when a page is loaded, for the first time, all images are saved in a cache pool of the browser. Hence, when next time a visitor open the page, browser fetches an image from that browser cache, and decreasing page load time.
Image Caching for wordpress blog or website, hosted on apache server is enabled by editing .htacccess file in root or the specified directory for which image cache is to be enabled. Basically, a browser reads .htaccess file for cache control headers, which asks browser to save the image or any media, for 2 weeks (or more) so that the image or any media can be pulled by the browser until it expires. For instance, after 2 weeks the image will expire and browser will have to reload the image or media again in the cache. If browser cache is cleared, in that case browser will again have to reload the image or media in the cache.
Below is the step-by-step tutorial, on enabling Image Cache for wordpress blog or websie.
If you are particular about the improving performance of your web assets, you should enable Image Caching on Web server. The procedure goes right under:
Note: Before making any changes, backup the website data as well as the htaccess file.
1. Open the .htaccess file located in the root of web hosting (using ftp).
2. Add the below code snippet in the .htaccess file
1: # Image and Flash content Caching for One Month
2: <FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$">
3: Header set Cache-Control "max-age=2592000"
4: </FilesMatch>
3. Once the htaccess file is edited, save it. It will turn on the Image Caching and Flash Content Caching for one month, as depending upon the ‘max-age’ parameter value equals 2592000. Conversion Unit is 3600 = 1 hour and 29030400 = 1 year, that is cache file will never expire.
The above procedure if applied correctly will really effect the performance of your website or web blog hosted on Apache.
For any queries or further assistance required, post comment as your feedback.












{ 6 comments… read them below or add one }
Quite useful for me as site contains a lot of images.. So going to try this.
thank u aky joe i going to do right now
Thanks for the tutorial, this is working for my website…
Hey thanks alot for such an simple remedy. Should we cache the css and javascript files to, and if so is it as simple as adding css / js to the list in the code?
Thanks
Didn’t work for me. Does it have to go in a certain spot in the htaccess file? Does it take time to work?
what do you think about ‘w3 total cache’ or similar solutions? is there any page that compares plugins and their functions/capabilities?