IIS7: HTTP->HTTPS Cleanly

前端 未结 6 1090
轮回少年
轮回少年 2020-12-04 06:32

Is there a clean way to redirect all attempts to going to an HTTP:// version of a site to its HTTPS:// equivalent?

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 06:58

    The most easy and clean solution I found was to

    1. In SSL Settings -> require SSL

    2. In Error Pages -> On 403.4 error -> Redirect to the HTTPS site

    3. In Error Pages -> Edit Features Settings... -> Set Detailed errors for local requests and custom error pages for remote request

    The benefit is that it requires no extra lines of code. Downside is that it redirects you to an absolute url.

提交回复
热议问题