0
http://www.example.com,http://example.comまたはhttps://www.example.comからhttps://example.comへリダイレクトします。 web.configファイルでこれを行うにはどうすればよいですか?Web.config http://www.example.comからhttps://example.comへリダイレクト
http://www.example.com,http://example.comまたはhttps://www.example.comからhttps://example.comへリダイレクトします。 web.configファイルでこれを行うにはどうすればよいですか?Web.config http://www.example.comからhttps://example.comへリダイレクト
URL書き換えモジュールをインストールします(デフォルトではインストールされません)。 http://www.iis.net/downloads/microsoft/url-rewrite
これを取得したら、web.configのsystem.webServer/rewrite/rulesのルールセクションを設定できます。このルールを追加:
<rule name="Redirect www to domain" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="false">
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_HOST}" pattern="^www.example.com" />
</conditions>
<action type="Redirect" url="https://example.com/{R:1}" />
</rule>
これはルートURLでのみ機能します。すべてのルートではありません。 – Brian
私は他のルールを持っていて、それを一番上に置き、stopProcessing = "false"を設定しなければならないことを認識しました。 – Brian