I have a large wordpress site that I migrated from AWS/Linux to a different host that is Windows Server 2016.

I have been developing on wordpress for years but this is my first time back on Windows server in a while.

I remember that when updating wordpress it would write a web.config file that would update the rewrite structure for that directory. Now rewrites are basically broken - in that you shouldn't have admin choices that break your site.

Out of the box Windows + IIS your rewrites have to contain index.php in the function or you go straight to post id.

What is weird is that when you choose permalink - /%category%/%postname%/ it is a 404 but if you manually add index.php before the category in the url it works.

So how is this supposed to work on Windows server now? I am guessing web.config isn't used. Has wordpress dev given up on windows servers and we just write our rewrite rules in IIS? Just trying to figure out the lay of the land as I have about 5 more sites to migrate and would like to best practices (well not really server best practices but wordpress best practices since the others taking over the sites after migration will not be as technical).

Just note that I did try to turn on the web.config and it gives a 500. Changing permalinks did nothing at all on the server - no added .htaccess nor a new web.config. Let me know if you need any other info.

3 Answers 3


Download IIS Rewrite from https://www.iis.net/downloads/microsoft/url-rewrite. Install and restart IIS

Then modify the web.config Edit web.config, add the rewrite code.

<?xml version="1.0" encoding="UTF-8"?>
                <add value="index.php" />

                <rule name="Main Rule" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    <action type="Rewrite" url="index.php" />

  • I have given you an upvote as it is useful but I answered it myself because the issue is actually that WP really was broke with multiple instances in IIS until recently.
    – STing
    Commented Dec 7, 2021 at 17:50
  • I did a wordpress migration from linux server to windows server and had the so called issue. This solved my problem. Although I couldn't tell exactly why this works. Can you explain those rewrite rules?
    – tataelm
    Commented Oct 1, 2022 at 14:52

you should install "URL Rewrite" module and restart the server not only iis service. then reconfigure "Permalink Settings".


I believe this issue is fixed in more recent WP versions and not sure which it was fixed in. But in older versions of WP the rule name="RULENAME" was always the same. The name must be unique or the IIS mod goes nuts.

You would also run into this if you are copying a complete site for backup or dev.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.