网站http强制转换https访问

参考:https://www.cnblogs.com/yangfei123/p/10130609.html

php配置.htaccess文件如下:

方法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} ^job.92bear.com/wap [NC]
RewriteRule ^(.*)$ https://job.92bear.com/wap [R,L]

</IfModule>

持续完善,待续...

发布了179 篇原创文章 · 获赞 16 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/yan_dk/article/details/94615332