Answered by:
Wordpress image request causes 500.50 URL Rewrite Module Error

Question
-
User1896052318 posted
Hello,
I have a wordpress installation unsing IIS7. This site is configured to use s custom permalink url structure like /%category%/%postname%/ .
This structure works well, and I am able to request pages, however on these pages I have images inserted using the url image that wordpress provides.
http://www.web-wired.com/wp-content/uploads/2009/07/of_blockdevice.png
These images fail to load, and when access directly, result in
HTTP Error 500.50 - URL Rewrite Module Error.
Module RewriteModule Notification BeginRequest Handler StaticFile Error Code 0x80070005 Requested URL http://www.web-wired.com:80/wp-content/uploads/2009/07/of_blockdevice.png Physical Path C:\inetpub\...\wp-content\uploads\2009\07\of_blockdevice.png Logon Method Not yet determined Logon User Not yet determined The image above does exist, and other images, such as http://wordpress.web-wired.com/wp-content/uploads/2009/07/of_blockdevice-150x142.png actually load just fine.
I have a web.config that is like this:
<?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>
<rule name="Rule1" enabled="false" patternSyntax="Wildcard" stopProcessing="true">
<match url="^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js)(\?.+)?)$" ignoreCase="true" />
<action type="Rewrite" url="{R:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
<tracing>
<traceFailedRequests>
<add path="*">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,Rewrite" verbosity="Verbose" />
</traceAreas>
<failureDefinitions statusCodes="200-999" />
</add>
</traceFailedRequests>
</tracing>
</system.webServer>
</configuration>But there is no tracing output being recorded. Is there something I need to accomplish to load images correctly?
Thanks
Wednesday, July 15, 2009 12:44 AM
Answers
-
User1896052318 posted
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.
Thanks!
- Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
Wednesday, July 15, 2009 9:08 PM
All replies
-
User1896052318 posted
It does appear that when WordPress uploads the image, it is not able to set the correct permissions on the original file, but the additional smaller sized files that it creates, the permissions are inherited.
So it does not appear to be related to a rewrite rule. I'll have to look into wordpress to see why this may be.
Wednesday, July 15, 2009 7:49 AM -
User-1637866776 posted
I've seen similar errors happening when IIS Worker Process does not have permissions to the file or directory that it is being check for existence by using the IsFile or IsDirectory condition. So, I think you may be right in thinking that this is caused by permission settings.
Wednesday, July 15, 2009 1:10 PM -
User1896052318 posted
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.
Thanks!
- Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
Wednesday, July 15, 2009 9:08 PM -
User2112012628 posted
Here is a full tutorial/fix and explanation for this.
http://www.digitalpimple.com/tutorials/windows-tutorials/fix-550-rewrite-error/
This was quite annoying.
Wednesday, October 7, 2009 8:33 PM -
User1963142912 posted
Great explanation with clear instructions on how to remedy.
Thanks, iis_isz!Also thanks to JohnnyVegas for the link to the full article; it's not loading at the moment but I have it marked for later reading.
Wednesday, August 25, 2010 12:06 PM -
User-1157192132 posted
I know ur solution worked.........I am also facing same issue for my PDf in Wordpress website.
how to Change the path of the temp folder in the PHP.ini file to a folder that does have
IIS_IUSRS write/modify permission.
We have already given read and write permission still shows the error.
plz suggest
thnx
Tuesday, January 21, 2014 3:17 AM