Sitecore URL重定向HTTP到HTTPS

Sitecore URL重定向HTTP到HTTPS,sitecore,Sitecore,我们一直在使用Sitecore 6.5,并在一个实例中部署了多个站点。我们一直在尝试将一个站点的HTTP重定向到https 我们尝试过各种重写规则,但都没有成功。有人能帮我们吗?尝试以下IIS URL重写规则: <rule name="Force HTTPS Redirection" enabled="true" stopProcessing="true"> <match url="(.*)" ignoreCase="false" /> &

我们一直在使用Sitecore 6.5,并在一个实例中部署了多个站点。我们一直在尝试将一个站点的HTTP重定向到https


我们尝试过各种重写规则,但都没有成功。有人能帮我们吗?

尝试以下IIS URL重写规则:

    <rule name="Force HTTPS Redirection" enabled="true" stopProcessing="true">
      <match url="(.*)" ignoreCase="false" />
      <conditions>
        <add input="{HTTPS}" pattern="^OFF$" />
        <add input="{HTTP_METHOD}" pattern="GET" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
    </rule>


这直接取自Azure的默认Sitecore 9安装。

您可以使用.htaccess强制https

一般的

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
重定向所有Web流量

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
仅重定向指定的域

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
如果这不起作用,请尝试删除前两行

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
重定向指定的文件夹

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.example.com/folder/$1 [R=301,L]

stackoverflow适用于与代码相关的问题,如果您认为您的重定向角色有问题,请发布它们并提出更具体的问题,否则您应该尝试社区