Using Browser Cache for WordPress on a Windows Server


If you are running your wordpress on a windows server you have to deal with browser caching at some point.

What is browser caching?

Browser caching is your users saving parts of your website on their PC so that they don’t have to download it again, when they return.
This could be pictures or css-files for example. The advantage for the visitor is that the website will load much faster.

You can define rules on what files to cache and for how long.

How to add browser caching to a wordpress website on a windows server?

Just open your web.config file and add this code beneath the system.webServer-Node.

   <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />

If you don’t have a web.config file in your wordpress base folder you will have to create one. Otherwise wordpress won’t route subpages and posts correctly.

You can learn how to create a web.config for wordpress on windows servers here.

Any more questions? Ask them in the comments!


Please enter your comment!
Please enter your name here