www.sitename.com未重定向至https://www.sitename.com

时间:2019-05-06 06:38:07

标签: windows iis mod-rewrite server

对于IIS mod_rewrite,我需要以下内容

  1. http://www.example.com重定向到https://www.example.com

  2. example.comhttps://www.example.com

  3. www.example.comhttps://www.example.com

我正在使用这个www.sitename.comsitename.com的那个不起作用-出现404错误:

<rewrite>
  <rules>
    <clear />
    <rule name="Force WWW and SSL" enabled="true" stopProcessing="true">
      <match url="(.*)" />
      <conditions logicalGrouping="MatchAny">
        <add input="{HTTP_HOST}" pattern="^[^www]" />
        <add input="{HTTPS}" pattern="off" />
      </conditions>
      <action type="Redirect" url="sitename.com{R:1}" appendQueryString="true" redirectType="Permanent" />
    </rule>
  </rules>
</rewrite>

1 个答案:

答案 0 :(得分:0)

这应该将http移至https,只需将下面的代码添加到您的e.x. {your OpenCV path}\opencv\build\java\x64 or {your OpenCV path}\opencv\build\java\x86

web.config

对于apache用户,只需将下面的代码添加到<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="Permanent" url="https://{HTTP_HOST}/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration> 文件中

.htaccess