Windows ServerWordpress

Enable URL rewrite WordPress on IIS

By default, when you install WordPress on IIS, the URL rewrite is not enabled by default. By have URL rewrite, you can use pretty permalinks ie. myblog/2019/01/hello-world/ or myblog/1335/ etc. These are example of pretty permalinks which should enable URL rewrite.

Backup web.config

Make sure you backup web.config file, by copying into new file called web.config_bak or something else. REMEMBER to backup first before do things

Add some line to web.config

Now add some lines into web.config file and add into system.webServer element line.

<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>

And save it. Now your WordPress on IIS able having pretty permalinks!

Leave a Reply

Your email address will not be published. Required fields are marked *