Removing /index.php/ from Permalinks in WordPress on Windows Server / IIS using URL Rewrites in web.config


By John Biswell on 20th June, 2013.

Windows and WordPress

A common issue when running WordPress on Windows Server and IIS is that by default you will see /index.php/ in all URLs. We want to removing /index.php/ from permalinks and make things look a bit more tidy.

Most users prefer much more user friendly URLs without “/index.php/”. Fortunately it’s simple to do…

Removing /index.php/ from Permalinks

In WordPress itself, under Settings –> Permalinks set Common Settings to Custom Structure: http://yourwebsite.com /%postname%/

Then, edit your web.config and add the following section to the system.webServer section:


<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/{R:0}" />
 </rule>
 </rules>
</rewrite>

Your URLs should now be rewritten as the much more friendly format. For more how-to guide and content like this, read our blog.


John Biswell

Operations Director

John is Operations Director at Secura and a Windows Server expert. Before all things IIS related, he was also a champion powerlifter.

Tweet me at:
@securacloud


  • Kamran Adeel

    Great!
    Its work for me
    Thanks a lot.

Access More Tech Articles and Content Like This?

Sign-up to the Secura Newsletter

We never share your details or spam you. We're not that person.