So I’ve been struggling with some issues on my wordpress site. Its hosted on IIS on a Windows Server 2012 R2.

The site was up and running and everything was working just fine but  as soon as I change the permalink scheme to other than “Plain”, It  doesn’t work. Now, that’s a bummer because of the time I spent to set up  this site and now it’s saying “no no” to me!

Then I found out that the solution was simple. Its all about  web.config with IIS so I searched around google and found out that I had  to put rewrite rules in order for it to work. So I created web.config  at the root of my site (because it didn’t exist) and put following  contents in it and it worked like a charm. 😉

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <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" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
        <directoryBrowse enabled="true" />
    </system.webServer>
</configuration>

Hopefully everything is in good state at this point and I’m back to happy again. 🖖