It’s been year, never checked how was my blog performing, and I decided to speed it up with WP Super Cache Configuration on Windows hosting. Finally, I made it. if you are having MVC website you can check previous post where you can change your web.config and Speed up your MVC website
When you install WP Super Cache on Linux hosting most of the configurations are working out of the box. In case of IIS / Windows hosting out of the box .htaccess doesn’t help you much. So here are the steps to be performed to make sure it boosts your site up.
Step 1: Go to the root folder of your website where you have installed WordPress, check if you have web.config if its there insert the rule below under rewrite rules if not create new file web.config file.
<rule name=”WP Super Cache IIS” stopProcessing=”true”>
<match url=”(.*)” />
<conditions logicalGrouping=”MatchAll”>
<add input=”{REQUEST_METHOD}” pattern=”^POST$” negate=”true” />
<add input=”{QUERY_STRING}” pattern=”.*=.*” negate=”true” />
<add input=”{QUERY_STRING}” pattern=”.*attachment_id=.*” negate=”true” />
<add input=”{HTTP_COOKIE}” pattern=”^.*(comment_author_|wordpress|wp-postpass_).*$” negate=”true” />
<add input=”{DOCUMENT_ROOT}/wp-content/cache/supercache/{HTTP_HOST}/{R:1}index.html” matchType=”IsFile” />
</conditions>
<action type=”Rewrite” url=”wp-content/cache/supercache/{HTTP_HOST}/{R:1}index.html” />
</rule>
Now once this is done you are nearly finished.
Step2: Completely optional if you are not configuring Garbage collection under advance option of WP Super Cache
However, if you configured it. you need to create one more web.config under <your root>\wp-content\cache
with below block of code
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name=”Cache-Control” value=”max-age=86400, must-revalidate” />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Make sure max-age value on Garbage Collector and web.config matches.
If you want your WP Super Cache to start performing immediately
Finaly, Just start preload and you are all set! I do not have screenshot of my own website result. But I can share one of my clients website speed comparison before and after configuration with WP Super Cache.
Comment below and let me know if this helps you or if you are facing any issues configuring WP Super Cache Configuration on Windows hosting.
If you liked this article, then please subscribe to our Blog for more updates like this. You can also connect me on Twitter, LinkedIn and GitHub.
Hi Vinay
I’m very grateful for you creating this as it was a great place to start for me. A couple of things I found with your sample addition to the web.config file.
First thing to note is that the HTTP_HOST server variable does not exists in IIS, and it should be SERVER_NAME. Also I discovered that the SERVER_NAME variable should be preceded with the percent symbol, %, otherwise on occasions with some pages, the browser (esp. Firefox) thinks some pages are of type ‘application/octet-stream’ and asks what to open it with. To be honest, I’m not entirely sure why that is, or what the % does, but including it prevents this issue from occurring.
So the rule checking the file exists should have {HTTP_HOST} replaced with %{SERVER_NAME}, so it looks like this:
Also, the actual Rewrite rule also needs to be modified to use the {SERVER_NAME} variable (this time without the % sign), so it looks like this:
The final thing to note is that WP Super Cache saves files with an -https suffix if the website is being served over Secure HTTPS protocol, so index.html becomes index-https.html.
As such, for HTTPS websites this condition and the rewrite rule, should be as follows:
Hope this helps, and thanks for posting this.
Regards,
Simon
Thanks for your feedback.
HTTP_HOST does exists and supported by IIS Ref : MSDN
Hope this helps
Thank you
Vinay Patel