Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress permalinks on IIS?

I am using WordPress on Windows 7 IIS to develop. I am uploading images in WordPress for a blog post. The image displays fine on the web site but as soon as I enable permalinks the images no longer work and any future images uploaded I get back an error:

HTTP Error 500.50 - URL Rewrite Module Error.
The page cannot be displayed because an internal server error has occurred.

I am not sure why this would be happening, here is my web.config:

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

As soon as I turn off my permalinks and use the default it works, does anyone know why this could be?

like image 486
Jeff Taggarty Avatar asked Dec 09 '10 21:12

Jeff Taggarty


People also ask

How do I find my WordPress permalinks?

Sign in to WordPress. In the left-side menu, select Settings and then select Permalinks. Select the permalink structure you prefer or select Custom Structure and create a custom one. Note: OPTIONAL: You can also create a structure for your categories and tags.


2 Answers

The image issue was a permission issue, but simply setting it manually on the original image file or parent folder is inadequate. The behavior of WordPress is that it writes the original file using IUSR to a temporary system directory that is defined in the PHP.ini file. This temp folder does not have IIS_IUSRS permissions on it, so when windows moves this file from the temp folder to the application's upload folder, its final home, IIS_IUSRS only has read permissions, so the permissions are not inherited from the file's parent folder.

To fix this, there are two solutions.

  1. Change the permissions on the temp folder giving IIS_IUSRS write/modify.
  2. Change the path of the temp folder in the PHP.ini file to a folder that does have IIS_IUSRS write/modify permission.

Here is a good source detailing the problem: http://www.howyoudo.info/index.php/how-to-fix-windows-server-upload-file-inherit-permissions-error/

I chose to move the temp folder in my PHP.ini to C:\inetpub\temp\uploads and also give it permissions. After uploading an image in wp-admin, I was able to access the image (original, not resized) from a browser wihout the 500.50 error.

From source

like image 59
MikeMurko Avatar answered Sep 30 '22 20:09

MikeMurko


There's a slightly different web.config at Using Permalinks « WordPress Codex as well as other options for Permalinks without mod rewrite on Windows.

like image 30
markratledge Avatar answered Sep 30 '22 19:09

markratledge