wordpress logo

WordPress + Web.config “not found” error on home page

wordpress logo

I was trying to setup wordpress on IIS when i faced this problem. I placed a web.config file with given xml code and pretty urls (permalinks) worked fine on all page except the home page. Home page gave a Not Found error while pretty permalinks worked find on all other pages. After adding the following code (given below) in system.webServer settings to web.config it worked find. In short the code given below adds index.php as a default document root.

<defaultDocument>
<files>
       <remove value="index.php" />
       <add value="index.php" />
    </files>
</defaultDocument>

After adding the above code my working web.config looked like:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
       <defaultDocument>
          <files>
             <remove value="index.php" />
             <add value="index.php" />
           </files>
        </defaultDocument>
        <rewrite>
           <rules>
              <rule name="wordpress" patternSyntax="Wildcard">
                 <match url="*" />
                 <conditions>
                   <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>
    </system.webServer>
</configuration>

Leave a Reply

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