Apache由http自动跳转到https的方法

发布时间:2020-08-07 21:17:31 作者:wq2010feng
来源:网络 阅读:4913

修改根目录.htaccess文件

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

#thinkphp去掉index.php
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

    #http自动跳转到https
  RewriteCond %{SERVER_PORT} !^443$
    #只有匹配对应的域名才会跳转
  RewriteCond %{SERVER_NAME} ^jenny.party|www.jenny.party$
  RewriteRule (.*) https://%{SERVER_NAME}/$1 [R]

    #不带www自动跳转到带www
    RewriteEngine On
  RewriteCond %{http_host} ^hrsc.cc [NC]
  RewriteRule ^(.*)$ https://www.hrsc.cc/$1 [L,R=301]
</IfModule>
推荐阅读:
  1. 实现网站由http协议转为https协议
  2. Apache如何将HTTP重定向到HTTPS

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

http https 自动跳转

上一篇:kubectl 命令梳理

下一篇:oracle增加字段带默认值

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》