http强制重定向https

http强制重定向https

(1)在网站根目录建立一个.htaccess的文件

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

(2)apache添加rewrite模块

LoadModule rewrite_module /path/to/mod_rewrite.so
Comments are closed.