2016-05-08 6 views
0

IISサーバーにWordPressがインストールされており、SSL証明書もインストールされています。web.configを使用してHTTPをHTTPにリダイレクト

私はこれで見つけることができるすべてのスレッドを調査しましたが、まだそれを動作させることができませんでした。私はthis threadを同じ問題に直面しているApacheの人から見つけましたが、私はIIS上にあり、IISで動作させる方法を知らない。そのスレッドに似て

は、ここで何が起こっているかである。

https://www.example.comは素晴らしいまた、上記にリダイレクトされた偉大な

https://example.comを働いています!ここで

は問題です:

http://example.comhttp://www.example.comにリダイレクトします。これはまたhttps://www.example.com

にリダイレクトする必要があるとして

http://www.example.comは、まだ良いアクセスできません。

どのように修正すれば、すべてがhttps://www.example.comにリダイレクトされるのですか?

私はIIS上だとここに私のweb.configは、次のようになります。

<?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" /> 
      </rule> 
     </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 
+1

[this](https://gist.github.com/tkarpinski/1621178)を試しましたか? – MinhTri

+0

既に存在するルールに加えてそのルールを追加しますか?はいの場合は、その新しいルールは前または後になりますか? – Ciwan

+0

@シアンなぜ試してみませんか? –

答えて

2

おかげで、これは働いていました。

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <rewrite> 
     <rules> 
     <rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
     <match url="(.*)" /> 
     <conditions> 
     <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
     </conditions> 
     <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> 
    </rule> 
      <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" /> 
      </rule> 
     </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 
0

まず、私はあなたのIISの「URL Rewrite」と呼ばれる拡張機能を取得するためにあなたを提案したいと思います。

その後、次のコードを使用してコードを一致させる必要があります:ダンへ

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
    <rewrite> 
     <rules> 
     <rule name="HTTP/S to HTTPS Redirect" enabled="true" stopProcessing="true"> 
     <match url="(.*)" /> 
     <conditions logicalGrouping="MatchAny"> 
      <add input="{SERVER_PORT_SECURE}" pattern="^1$" /> 
      <add input="{SERVER_PORT_SECURE}" pattern="^0$" /> 
     </conditions> 
     <action type="Redirect" url="https://{HTTP_HOST}/OWA/" redirectType="Permanent" /> 
     </rule> 
     </rules> 
    </rewrite> 
    </system.webServer> 
</configuration> 
関連する問題