2017-12-21 14 views
1

httpsを強制するために私のweb.configに次のものがあります。HTTPS web.configのwwwリダイレクト

<rule name="Redirect to https" stopProcessing="true"> 
<match url="(.*)" /> 
<conditions> 
<add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
</conditions> 
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /> 
</rule> 

しかし、私は強制的にwww。これらのすべてがhttps://wwwバージョンになるようにします。達成する必要があるもの:

http://www.domain.tld/whatever 
http://(no-www)domain.tld/whatever 
https://(no-www)domain.tld/whatever 

ありがとう。

+0

@cfnerdこんにちは、私はそれを最初に使用しましたが、それはhoを含んでいませんwを強制するw。部。 – doubleplusgood

答えて

0

このルールでは、次の操作を行います:HTTPSへ

  • リダイレクト
  • フォースWWW

<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="off" />
<add input="{HTTP_HOST}" pattern="^www." negate="true" />
</conditions>
<action type="Redirect" url="https://www.example.com{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>

をあなたが必要とするすべてはあなたのドメイン名

www.example.comを変更することです
関連する問題