IIS web.config to use automatic 301 jump from http to https in

 Now, after a lot of sites for security, opening the SSL connection, then turn on SSL connections, how to access the corresponding http automatically jump to https on it? Before the introduction of the method of jump IIS to do with the domain name web.config 301, IIS can also use the URL http web.config implement automatic 301 jump to https URL.

An article on the use of the domain name be access to 301 jumps, that is, to determine the visitor's domain name, and then jump. But the URL http and https access is the same, web.config above the code so that the article can not be used.

In fact, a change in thinking became clear, it is judged that the domain name to die, we can not directly determine https state? Https automatically jump to the non-state corresponding to the URL https.

web.config code is as follows:

  

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
  <rewrite>
   <rules>
    <rule name="HTTPS iCoA" stopProcessing="true">
     <match url=".*" />
     <conditions>
      <add input="{HTTPS}" pattern="^off" />
     </conditions>
     <action type="Redirect" url="http://www.yuanzhumuban.cc/{R:0}" redirectType="Permanent" />
    </rule>
   </rules>
  </rewrite>
 </system.webServer>
</configuration>

  

Guess you like

Origin www.cnblogs.com/68xi/p/11518979.html