在linux下有很多方法,这里就不说了,无论是通过配置本地文件还是网页修改。而最近遇到一个ASP网站,在网页中调用JS设置时拉慢网站打开速度,偶尔出现异常情况,这时候,我们修改网站目录下web.config即可达到跳转目的。
我们打开web.config文件,如果没有可创建一个,如果已经有的话,做有301跳转,我们在其中即可看到301跳转到http://www.benen.cn 之类的,只需要要把http改成https即可,后台301跳转有些不让加前缀,在这里加上即可。
如果没有文件,可以添加以下内容:
<rewrite>
<rules>
<rule name="http redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTPS_HOST}" pattern="^(localhost)" negate="true" />
</conditions>
<action type="Redirect" url="https://www.baidu.com/{R:1}" />
</rule>
</rules>
</rewrite>
其它方式可在https://www.benen.cn/?p=4693查看 。