How to speed up WordPress?
WordPress is the most used CMS nowadays. Although it’s well optimized out of the box we can make it even better. There are multiple ways to speed up your WordPress blog. In this article we will talk about leveraging browser caching via .htaccess. Leveraging browser caching is also very important for SEO. Even if you have great content google will give higher page rank to websites with lower load time.
What is Browser Cache?
All modern browser has browser cache. Browser cache allows to load previously loaded resources from the local disk if they are not expired. All browsers has some default expiration values based on the resource mime type. Unfortunately these values can’t work great for all websites. So knowing your website resources you can give the best instruction to client browser and as result get lowest load time.
How to leverage browser caching?
To leverage browser caching your server must be properly configured. For this you need mod_expires to be enabled on your Apache server. Most hosting providers are enabling it by default. If module is disabled you can ask your hosting provider to enable it.
There are two methods to get the result via plugin or manually. If you want to use plugin there are several WordPress plugins that are leveraging browser caching but we recommend W3 Total Cache. This is one of the most powerful caching plugins. It also has a bunch of other caching features but the one we need is browser caching. If you use caching plugins take into consideration that they are caching pages too. So if you have some automatically updated content users will be served with cached copy. So when choosing plugins be sure that they are compatible with caching plugins. Good example of such plugin is Aparg SmartAd. It is WordPress advertisement plugin and it has Anti-Cache feature. This allows you to load advertisements after the page was loaded and automatically change ads even with caching plugins enabled.
If you like to use some other WordPress cache plugin(e.g. WP Super Cache) that doesn’t support browser caching settings you can do this manually. To do this create .htaccess file in your blog root directory or if it already exists just modify it. You can set expiration period by resource mime type. It’s recommended to give long expiration period to resources like images, video/audio and pdf. As for script resources it’s better to give shorter expiration period. You can play with different expiration values to find configurations that best fit to your WordPress blog. Based on our experience we will post configurations that are suitable for most websites and get good results in Google PageSpeed test.