Solved – IIS/WordPress Permalinks Error: “403 – Forbidden: Access is denied.”

Leave a comment
Share

I’m running WordPress on IIS7.5 .  After I’d enabled the Permalinks feature, I found that whenever I clicked on a link, I’d just see an error message

403 – Forbidden: Access is denied.

Not nice.  The IIS log revealed that it was actually 403.18 , which I’d never seen before.  I found the answer, though.  When you enable permalinks, and WordPress doesn’t have access to your root web.config file, it tells you to paste this into its <configuration><system.webServer><rewrite><rules> section:

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

HOWEVER, this doesn’t work if your WP site is a subdirectory of the main web site.  What fixed it for me is to create a separate web.config file in the WordPress program folder.  Should that have been obvious to me?  If so, then I apologise to the clever people at WordPress (thanks for a superb blogging app, by the way).  Anyway, here are the complete contents of the web.config file that I now have in the WordPress folder:

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
  <system.webServer>
    <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.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>