Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example web.config for WordPress on IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<clear />
<rule name="WordPress Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<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>
<outboundRules>
<clear />
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
@Toddses

This comment has been minimized.

Copy link
Owner Author

@Toddses Toddses commented Feb 3, 2015

Note the line <action type="Rewrite" url="index.php" /> is key. The rule I found through official WP channels suggests using url="index.php?page_id={R:0}" but this was flawed. Any post that began with a number would return a 404 error.

@shakirmengrani

This comment has been minimized.

Copy link

@shakirmengrani shakirmengrani commented Apr 13, 2019

Awesome!! it's really helpful for me

@deshabhishek007

This comment has been minimized.

Copy link

@deshabhishek007 deshabhishek007 commented May 22, 2019

Thanks, Todd! it worked like Charm.

@newmediacrew

This comment has been minimized.

Copy link

@newmediacrew newmediacrew commented Sep 25, 2019

Hi Todd,

We have 0 experience with Windows IIS, and this did the job for fixing the permalinks. Thanks for that !

@TrezRayanCo

This comment has been minimized.

Copy link

@TrezRayanCo TrezRayanCo commented Oct 2, 2019

Thank you

@hsankala

This comment has been minimized.

Copy link

@hsankala hsankala commented Oct 14, 2019

Thanks

@Amritmatti

This comment has been minimized.

Copy link

@Amritmatti Amritmatti commented Feb 24, 2020

I don't have much knowledge about Windows. I was working from last 2 days but no luck. Thanks @Toddses you saved my time. It's working :)

@Satyam506

This comment has been minimized.

Copy link

@Satyam506 Satyam506 commented May 30, 2021

Thanks man 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment