5

http にある必要があるファイルがいくつかあります。次のコードを試しましたが、機能しません。web.config でページ page1、page2 に強制 HTTP を設定するにはどうすればよいですか

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
    <rewrite>
        <rules>
            <rule name="Force HTTP" stopProcessing="true">
                <match url="(.*)/page1.php" ignoreCase="false"/>
                                <match url="(.*)/page2.php" ignoreCase="false"/>
                <conditions> 
                    <add input="{HTTPS}" pattern="ON" ignoreCase="true"/>
                </conditions>
                <action type="Redirect" url="http://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
            </rule>
        </rules>
    </rewrite>
    </system.webServer>
</configuration>

WindowsのPHPアプリケーション用のIIS 7 Webサーバーで作業しています

4

1 に答える 1

3

ルールを次のように変更する必要があります。

<rule name="Force HTTP" stopProcessing="true">  
  <match url="^page[12].php(.*)" />  
  <conditions>  
    <add input="{HTTPS}" pattern="^ON$" />  
  </conditions>  
  <action type="Redirect" url="http://{HTTP_HOST}/{R:0}" redirectType="Permanent" />  
</rule>  

は、またはurl="^page[12].php(.*)"で始まるすべての URL と一致します。このアクションは、要求されたパスを含む場所に 要求をリダイレクトします。page1.phppage2.php
https://{HTTP_HOST}/{R:0}{R:0}

于 2013-02-13T16:50:45.853 に答える