2017-07-12 7 views
0

内にあるとき、私は、この書き換えルールがあります。IISのHTTPウェブアプリはサイト

<rewrite> 
     <rules> 
    <rule name="Redirect to http" enabled="true" patternSyntax="Wildcard" stopProcessing="true"> 
     <match url="*" negate="false" /> 
     <conditions logicalGrouping="MatchAny"> 
      <add input="{HTTPS}" pattern="off" /> 
     </conditions> 
     <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" /> 
    </rule> 
</rules> 
    </rewrite> 

をそして私がhttps TRAFICに、すべてのHTTPをrediretしたいのですが、事は私のWebアプリはルートではありませんされてフォルダ、それはこのようなものだ:

http:\\my-site.com\MyWebApp\some-parameters-here

とリダイレクト後にそれが行く:

https:\\my-site.com\some-parameters-here

代わりに、このリダイレクトは、URLでその部分のハードcoddingなく固定することができますどのように

https:\\my-site.com\MyWebApp\some-parameters-here

...?私の作品

答えて

0

<rule name="HTTP to HTTPS redirect" enabled="false" stopProcessing="true"> 
<match url="(.*)" /> 
<conditions logicalGrouping="MatchAll" trackAllCaptures="false"> 
     <add input="{HTTPS}" pattern="^OFF$" /> 
     <add input="{HTTP_HOST}" pattern="^((.+)?my-site\.com)$" /> 
</conditions> 
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" /> 

キーは、交換がある:{R:1}

<rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions> 
    <add input="{HTTPS}" pattern="^OFF$" /> 
    </conditions> 
    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" 
     redirectType="Permanent" /> 
    </rule> 
+0

確かに:これは、あなたのコメントを使用でき

についてHTTP_HOST

UPDATE せずに完全なリンクを維持するために許可されています。その行を削除することができます。私たちの設定のこの部分。私たちは証明書のないカップルのサイトを持っています。 – SouXin

+0

ありがとう、これは私のために働く。 – ShP

関連する問題