簡體   English   中英

WordPress網址重寫在iis7上不起作用

[英]Wordpress url rewriting does not work on iis7

我有一個在IIS7上運行的Wordpress網站。

我遇到了一個大問題,因為除主頁外,我所有的URL都包含index.php。

我的主頁:www.mywebsite.com其他:www.mywebsite.com/index.php/post1、www.mywebsite.com/index.php/post2等。

我想使用IIS7的URL重寫模式。 我的網絡主機告訴我重寫模塊已激活。

我不知道在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>

我的網址沒有改變!

和這個 :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Supprimer index.php">
                    <match url="^index.php/([_0-9a-z-]+)/([_0-9a-z-]+)" />
                    <action type="Rewrite" url="{R:1}/{R:2}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

我也嘗試過:

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

始終不起作用。

您能幫我從URL中刪除index.php嗎?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <httpErrors errorMode="Detailed"/>
    <rewrite>
      <rules>
        <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/{R:0}"/></rule>
            <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"/>
      </files>
    </defaultDocument>
  </system.webServer>
</configuration>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM