2017-05-13 9 views
1

Was ich tun muss, ist umleiten alle Anfrage an https und nicht www URL. Zum Beispiel: -http: // Beispiel .com/etwas # hash -> https: // Beispiel .com/etwas # hash - https://www. Beispiel .com/something # hash -> https: // Beispiel .com/something # hash - http://www. Beispiel .com/etwas # Hash -> https: // Beispiel .com/etwas # HashWeb.config Umleiten Sie alle auf https und nicht-www

Was ich tat, und nicht funktioniert ...:

<rewrite> 
    <rules> 
    <rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
     <match url="(.*)" /> 
     <conditions> 
     <add input="{HTTP_HOST}" pattern="localhost" negate="true" /> 
     <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
     </conditions> 
     <!--<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />--> 
     <action type="Redirect" url="https://example.com/{R:1}" redirectType="Permanent" /> 
    </rule> 

    <rule name="Redirect to non-www" stopProcessing="true"> 
     <match url="(.*)"></match> 
     <conditions> 
     <add input="{HTTP_HOST}" pattern="^example.com$" negate="true"></add> 
     </conditions> 
     <action type="Redirect" url="https://example.com/{R:1}" redirectType="Permanent" /> 
    </rule> 
    </rules> 
    <outboundRules> 
    <rule name="Add Strict-Transport-Security when HTTPS" enabled="true"> 
     <match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" /> 
     <conditions> 
     <add input="{HTTPS}" pattern="on" ignoreCase="true" /> 
     </conditions> 
     <action type="Rewrite" value="max-age=31536000" /> 
    </rule> 
    </outboundRules> 
</rewrite> 

Dank !!!

Antwort

0

Versuchen Sie folgendes:

<rule name="HTTP to HTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true"> 
        <match url="*" /> 
        <conditions> 
         <add input="{HTTPS}" pattern="off" /> 
        </conditions> 
        <action type="Redirect" url="https://www.{HTTP_HOST}{REQUEST_URI}" redirectType="Found" /> 
       </rule> 
Verwandte Themen