怎么将http强制转https,网站https强制转换http访问?php配置.htaccess文件如下:
网站http强制转换https访问
方法1:配置将所有http 80的访问转换为https的访问
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
</IfModule>
方法2:将特定的http访问路径,转换为指定的https的访问
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^www.8gws.com/wap [NC]
RewriteRule ^(.*)$ https://www.8gws.com/wap [R,L]
</IfModule>
网站https强制转换http访问
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{SERVER_PORT} =443
RewriteCond %{HTTP_HOST} ^www.xd0cms.cn$ [NC]
RewriteRule ^(.*)$ http://www.xd0cms.cn/$1 [L,R=301]
</IfModule>