WordPress Permalinks on IIS causes Error 500

Ok, I’ve been searching the net everywhere and although there are a few matches, it doesn’t solve my problem. I’m using WordPress 3.9, PHP 5.4.14, IIS8 on Windows 2012 and I have the URL Rewrite mod version 2 installed.
Whenever I turn Permalinks on in my WordPress site (/%category%/%postname%/), I get the following error (this is on the server. From client, additional info is hidden):

Internal Server Error 500.0
C:PHPv5.4php-cgi.exe – The FastCGI process exited unexpectedly
Module: FastCgiModule
Notification: ExecuteRequestHandler
Handler: PHP54_via_FastCGI
Error Code: 0x000000ff

Read More

This error occurs when navigating my site and even when working in wp-admin. However, if I hit refresh a couple of times, eventually the page does load (in most cases). Then I can perhaps navigate to another couple of pages before the error occurs again, but it seems that the error occurs every time when navigating to a blog post.
I’ve tried both the following web.config files and both with the same results.

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

Also tried replacing the rule with this one that I found in other threads, but the one above was generated by WordPress:

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

Related posts

Leave a Reply

3 comments

  1. Could you try this one?

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="WordPress Rule" stopProcessing="true">
    <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?page_id={R:0}" />
    </rule>
    </rules>
    </rewrite>
    </system.webServer>
    </configuration>
    
  2. Finally it seems that I got it working. I was using the Brandoo WordPress project in order to utilize MS SQL Server.

    So firstly I installed Project Nami on a blank site, then copied all the plugins over from my previous site and updated the config file to connect to my original database. Finally upgraded my PHP to version 5.5.15. It seems to be working fine now.

    —- Update
    Ok, it seems simply upgrading to PHP 5.5.15 alone solves the problem. Wasn’t my first choice since there are no official PHP SQL drivers available, but hey… it works flawlessly.

  3. I ran into the same error and although I didn’t try to update PHP, what worked for me was what was described near the end of https://codex.wordpress.org/Using_Permalinks:

    “(…) you can try PATHINFO permalinks; put index.php/ at the start of
    your custom permalink structure:”

    /index.php/%year%/%monthnum%/%day%/%postname%/
    

    By doing that, I didn’t have to touch the web.config file.