![](/img/trans.png)
[英]Site keeps redirecting to HTTP when I visit HTTPS, for no apparent reason
[英]Drupal site keeps on redirecting
基本URL已在settings.php文件中设置为
$base_url = 'https://<site_name>.com.au";
但是,当通过www.<site_name>.com.au
它时,它似乎将具有重定向循环。
这是.htaccess重写:
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} www\. [NC]
RewriteRule ^ http%{ENV:protossl}://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
强制或剥离www时,为避免HTTP和HTTPS之间出现反弹,还应在.htaccess文件中取消注释以下内容:
RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]
默认.htaccess文件中的注释按以下方式定义函数中的上述行:
如果通过https://访问我们,请将“ protossl”设置为“ s”。 如果启用“ www”,则稍后使用。 剥离或强制执行,以确保您不会在http和https之间跳出。
如果要手动添加这些行,请确保它们在您的重写之前,但在重写之后
<IfModule mod_rewrite.c> RewriteEngine on
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.