【问题标题】:How to redirect a non-virtual host from http to https如何将非虚拟主机从 http 重定向到 https
【发布时间】:2019-08-13 22:04:16
【问题描述】:

我想通过修改 httpd.conf 文件将 apache 服务器上的域的 http 重定向到 https。域是服务器名称,它不是虚拟主机。我发现的所有示例都是针对虚拟主机的。我怎样才能做到这一点?

我是否将代码放在''中?

【问题讨论】:

    标签: http redirect https httpd.conf


    【解决方案1】:

    您可以在 VirtualHost 之外的 httpd.conf 中添加重定向规则。

    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*) https://%{HTTP_HOST}/$1 [L,R]
    

    【讨论】:

      猜你喜欢
      • 2016-07-16
      • 2017-04-08
      • 2017-09-13
      • 2018-10-12
      • 2020-12-12
      • 2019-09-15
      • 2014-04-11
      • 2012-07-22
      • 2018-07-04
      相关资源
      最近更新 更多