IIS上的Wordpress固定链接导致错误500

时间:2014-08-12 12:06:05

标签: wordpress iis permalinks internal-server-error

好的,我一直在网上搜索,尽管有一些比赛,但它并没有解决我的问题。我在Windows 2012上使用Wordpress 3.9,PHP 5.4.14,IIS8,我安装了URL Rewrite mod版本2。 每当我在我的WordPress网站上打开固定链接(/%category%/%postname%/)时,我都会收到以下错误(这是在服务器上。来自客户端,隐藏了其他信息):

  

内部服务器错误500.0
  C:\ PHP \ v5.4 \ php-cgi.exe - FastCGI进程意外退出
  模块:FastCgiModule
  通知:ExecuteRequestHandler
  处理程序:PHP54_via_FastCGI
  错误代码:0x000000ff

导航我的网站时甚至在wp-admin中工作时都会发生此错误。但是,如果我点击几次刷新,最终页面会加载(在大多数情况下)。然后我可能会在错误再次发生之前导航到另外几页,但似乎每次导航到博客帖子时都会发生错误。 我已经尝试了以下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>

还尝试用我在其他线程中找到的规则替换规则,但上面的规则是由WordPress生成的:

<rule name="Main Rule" 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>

3 个答案:

答案 0 :(得分:2)

你可以试试这个吗?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress Rule" stopProcessing="true">
<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?page_id={R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

答案 1 :(得分:1)

最后似乎我得到了它的工作。我使用Brandoo Wordpress项目来利用MS SQL Server。

首先,我在一个空白站点上安装了Project Nami,然后从我以前的站点复制了所有插件,并更新了配置文件以连接到我的原始数据库。最后将我的PHP升级到版本5.5.15。现在似乎工作正常。

----更新
好吧,似乎只需升级到PHP 5.5.15就可以解决问题。由于没有可用的官方PHP SQL驱动程序,因此不是我的第一选择,但是嘿......它完美无瑕。

答案 2 :(得分:0)

我遇到了同样的错误,虽然我没有尝试更新PHP,但对我来说有用的是在https://codex.wordpress.org/Using_Permalinks附近描述的内容:

  

&#34;(...)你可以试试PATHINFO永久链接;把index.php /放在开头   您的自定义永久链接结构:&#34;

/index.php/%year%/%monthnum%/%day%/%postname%/

通过这样做,我没有必要触摸web.config文件。