Currently, I’m striving hard to optimize my blog. I’ve done installing WordPress plugin Super Cache, minified my JavaScript files, remove unecessary plugins / widgets, and the last but not the least, used a lightweight yet clean and beautiful theme.
But it’s not just fast enough! I want more speed, more efficient yet responsive and up to date website.
Using the tool from yahoo, called YSlow, it says that my files doesn’t have far future expiry date. So, I came to take a look about caching.
WordPress plugin WP-Super Cache was only to create a static page version of my dynamic page, but it does not cache static files such as JS files, CSS and images.
Reading from the article about “How To Optimize Your Site With HTTP Caching”, I finally decided to apply it to my site.
First, I know that my host supports .htaccess configurations, so here are my config:
<Files *.js> Header add "Cache-Control" "max-age=604800"
</Files>
<Files *.css> Header add "Cache-Control" "max-age=604800"
</Files>
<Files *.jpg> Header add "Cache-Control" "max-age=604800"
<Files *.gif> Header add "Cache-Control" "max-age=604800"
</Files>
<Files *.png> Header add "Cache-Control" "max-age=604800"
</Files>
The max-age I set was 1 week (604800 seconds).