0

我已将我的 WordPress 网站移至窗口服务器,但我遇到了问题。如果我将此代码的代码放在 web.config

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

然后网站给出错误 500.19 HTTP 500.19 内部服务器错误配置无效如果我从 web.config 中删除此代码,则网站仅适用于以 index.php 开头的永久链接,例如 index.php/opening-timings/

我已经搜索过这个问题,但无法解决

4

2 回答 2

1

我建议您按以下方式使用,但请确保您已在 IIS 服务器上启用重写规则模块,因为默认情况下它处于禁用阶段。

您还可以参考此链接来配置服务器 wordpress 永久链接

http://www.iis.net/learn/extensions/url-rewrite-module/enabling-pretty-permalinks-in-wordpress

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="wordpress" stopProcessing="true">
          <match url=".*" />
              <conditions logicalGrouping="MatchAll">
                <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>
于 2016-01-09T05:45:44.693 回答
0

在设置选项卡中的管理员端更改永久链接格式,单击永久链接。从格式中删除 index.php。比 URL 将没有 index.php。

于 2016-01-09T07:00:44.127 回答