IIS http forced to HTTPS (certificate installed)

Source: Internet
Author: User

1. Modify C:\inetpub\custerr\zh-CN\403.htm file, add in

<script type= "Text/javascript" >  
    var url=window.location.href;  
    Url=url.replace ("http:", "https:")  
    window.location.replace (URL);
</script>

The SSL-required SSL settings in IIS management need to be checked so that when you visit a page that is not HTTP, you jump to the 403 error page before you jump to the HTTPS page.

2. For the ASP.net site, you can modify the Web.config configuration file directly:

<?xml version= "1.0" encoding= "Utf-8"?> <configuration> <system.webserver
          > <rewrite> <rules> <rule name= "HTTP to HTTPS redirect" stopprocessing= "true" > <match url= "(. *)"/> <conditions> <add input= "{HTTPS}" pattern= "Off" ignoreCase = "true"/> </conditions> <action type= "Redirect" redirecttype= "Found" url= "Https://{http_h" Ost}/{r:1} "/> </rule> </rules> </rewrite> </system.webServer> </configu Ration> 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.