Wordpress 500(URL 重写模块错误。)

Wordpress 500 (URL Rewrite Module Error.)

我在 IIS 8 中托管一个 Wordpress 网站 我收到以下错误:

Failed to load resource: the server responded with a status of 500 (URL Rewrite Module Error.)

当我上传新图片并显示时。 如果我转到 wp-content 并授予 IIS_USRS 访问权限,则图像可以工作,当我添加新图像时,我必须删除 IIS_USRS 并再次添加它才能使图像工作

如果我使用以下网络配置,网站永远不会加载

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

在您的 web.config 文件中使用下面提到的这些规则:

<rules>

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

</rules>

我在iis管理器里面把安全选项卡的权限改成wordpress的wp-content文件夹,需要编辑然后我给了IIS_USRS完全控制,错误解决了

万一还有人遇到这个问题,为我解决这个问题的最后一步是将应用程序池的标识设置为 'local system'(右键单击列表中的应用程序池 -> 高级设置 - > 在 'process model' 部分下)

同时遵循 Alejandro 的建议并确保设置了足够的文件夹权限。

对我来说,更改应用程序池的身份有效(thx lockstock)。 作为解决方法,我通过裁剪图像并保存来测试它,不需要编辑权限。 我使用带有最新更新(IIS 10 和 PHP 7.4)的 win server2019。

注意: 如果你正在创建一个新的 wp 站点,默认情况下使用 http://localhost/?P=123 作为永久链接,但如果你想将其更改为 %postname%,wp 会在 URL 在 IIS 上重写,这是显示任何文件错误的原因,post。 希望对您有所帮助。

URL REWRITE RULE