跳转到主要内容
你行网

Main navigation

  • 首页
  • 文章
  • 教程
  • 视频
  • 下载
  • 社区
  • 网站导航
User account menu
  • 登录

面包屑

  1. 首页

drupal8 http 301重定向 https 问题

由 hrs, 17 七月, 2019
论坛
网站问题

apache 已经配置好https 加密证书,可以实现https://www.dwoke.com 加密访问

我想把http://www.dowoke.com 和http://dwoke.com  做301重定向到https://www.dwoke.com.com  这个域名上。

在drupl8 根目录下的配置文件.htaccess 文件内修改这两个代码

 # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/foo will be redirected to http://www.example.com/foo)
  # uncomment the following:
   #RewriteCond %{HTTP_HOST} .
   #RewriteCond %{HTTP_HOST} !^www\. [NC]
   #RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/foo will be redirected to http://example.com/foo)
  # uncomment the following:
   #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]

我发现只能选择一个,不能同时打开,如果同时打开会出现网站无法打开。

  RewriteCond %{HTTP_HOST} .
  RewriteCond %{HTTP_HOST} !^www\. [NC]
 RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

选择这一个,只能实现http://dwoke.com 跳转到http://www.dwoke.com

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
选择这一个,只能实现http://www.dwoke.com 跳转到http://dwoke.com

如果这样设置不是我想要的,如果知道的朋友请告知一下,谢谢

 

 

  • 登录或注册以发表评论

相关文章

RSS源
本站由阿里云强力驱动,幸运券优惠链接
Copyright © 2019 - 2021 你行网 版权所有  粤ICP备19072650号