我在Windows 7 IIS上使用WordPress进行开发。我正在WordPress中上传图片以获取博文。图像在网站上显示正常,但是一旦启用永久链接,图像就不再有效,并且未来的任何图像上传我都会收到错误:
HTTP Error 500.50 - URL Rewrite Module Error.
The page cannot be displayed because an internal server error has occurred.
我不确定为什么会发生这种情况,这是我的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>
只要我关闭固定链接并使用默认设置就可以了,有人知道为什么会这样吗?
答案 0 :(得分:13)
图像问题是权限问题,但只是手动设置 在原始图像文件或父文件夹上是不够的。该 WordPress的行为是它使用IUSR写入原始文件 到PHP.ini文件中定义的临时系统目录。 这个临时文件夹没有IIS_IUSRS权限,所以当 Windows将此文件从临时文件夹移动到应用程序 上传文件夹,它的最终主页,IIS_IUSRS只有读取权限,所以 权限不会从文件的父文件夹继承。
要解决此问题,有两种解决方案。
- 更改临时文件夹的权限,给予IIS_IUSRS写入/修改。
- 将PHP.ini文件中临时文件夹的路径更改为具有IIS_IUSRS写入/修改权限的文件夹。
醇>这是一个详细说明问题的好消息来源: http://www.howyoudo.info/index.php/how-to-fix-windows-server-upload-file-inherit-permissions-error/
我选择将PHP.ini中的临时文件夹移动到 C:\ inetpub \ temp \ uploads并赋予它权限。上传后 在wp-admin中的图像,我能够访问图像(原始,而不是 从浏览器调整大小而没有500.50错误。
答案 1 :(得分:1)
在Using Permalinks « WordPress Codex处有一个稍微不同的web.config以及在Windows上没有mod重写的永久链接的其他选项。
答案 2 :(得分:1)
为了帮助其他用户,此问题是由IIS中的权限引起的,修复程序也在此处:
答案 3 :(得分:0)
在web.config文件中使用下面提到的RULE ..
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^index\.php$" ignoreCase="false"/>
<action type="None"/>
</rule>
<rule name="Redirect Image to HTTP" stopProcessing="true">
<match url=".*\.(gif|jpg|jpeg|png|css|js)$" ignoreCase="true"/>
<action type="Rewrite" url="{R:0}"/>
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="." ignoreCase="false"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true"/>
</conditions>
<action type="Rewrite" url="/index.php"/>
</rule>