apache_conf 强制HTTPS

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf 强制HTTPS相关的知识,希望对你有一定的参考价值。

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
#If too many redirects, replace line 2 with line 4
#RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
RewriteEngine On
RewriteCond %{HTTP_HOST} sub\.domain\.co\.uk [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://sub.domain.co.uk/$1 [R,L]

以上是关于apache_conf 强制HTTPS的主要内容,如果未能解决你的问题,请参考以下文章

apache_conf 强制https

apache_conf 强制https通用

apache_conf 强制Https

apache_conf Apache - 强制HTTPS

apache_conf .htaccess强制https

apache_conf 使用.htaccess强制HTTPS