Php 写<;重写>;用于IIS服务器中web.config中的wordpress站点

Php 写<;重写>;用于IIS服务器中web.config中的wordpress站点,php,wordpress,iis,web-config,Php,Wordpress,Iis,Web Config,我已经在IIS服务器(Windows服务器64位R2标准版)中安装了wordpress。 为了成功运行wordpress站点,我必须在它的web.config文件中编写规则。当我试图在web.config文件中添加任何规则时,我得到一个错误500:内部服务器错误 以下是我的web.config文件代码: <?xml version="1.0" encoding="UTF-8"?><configuration> <system.webServer> &l

我已经在IIS服务器(Windows服务器64位R2标准版)中安装了wordpress。 为了成功运行wordpress站点,我必须在它的web.config文件中编写规则。当我试图在web.config文件中添加任何规则时,我得到一个错误500:内部服务器错误

以下是我的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>
<httpErrors>  
  <remove statusCode="404" subStatusCode="-1" />  
  <error statusCode="404" prefixLanguageFilePath=""  path="/index.php?error=404"  responseMode="ExecuteURL" />  
</httpErrors>
<staticContent>
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
        <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
        <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />

    </staticContent>
</system.webServer></configuration>

若我删除了标签,那个么它是工作的,但站点的其他部分是不工作的(比如添加到购物车和结账过程等)

那么,我如何在web.config文件中写入

谢谢,
Ketan

您最好备份并删除web.config文件,然后使用WordPress permalinks页面为您生成web.config文件。最后,以增量方式添加WordPress不能为您提供的功能。

我得到了答案,实际上在IIS服务器中,默认情况下,重写模块是禁用的。我们必须使它能够在web.config中使用写入规则。启用此模块后,我的站点工作正常。希望这能帮助别人。

在IIS上使用这些规则

        <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中,默认情况下禁用服务器重写模块。我们必须使它能够在web.config中使用写入规则。