【问题标题】:URL Rewrite IIS and WordpressURL 重写 IIS 和 Wordpress
【发布时间】:2018-12-06 00:57:06
【问题描述】:

我有这个以下 web.conf

<?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>
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />
                <add value="default.aspx" />
            </files>
        </defaultDocument>

  </system.webServer>
</configuration>

wordpress 网站可以工作,但是如果我查看图像示例http://domain/wp-content/uploads/2018/06/home-slide-5.jpg 时,某些图像会出现以下错误@

HTTP 错误 500.50 - URL 重写模块错误。 该页面无法显示,因为发生了内部服务器错误。

【问题讨论】:

    标签: wordpress iis


    【解决方案1】:

    我已经在规则中添加了以下内容,现在它似乎可以工作了

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

    致谢:Wordpress permalinks on IIS?

    【讨论】:

      猜你喜欢
      • 2012-06-19
      • 2013-10-06
      • 2011-05-23
      • 1970-01-01
      • 1970-01-01
      • 2020-08-26
      • 2011-02-12
      • 2018-07-25
      • 2013-07-01
      相关资源
      最近更新 更多