【问题标题】:Apache Total redirect with vhost to https expect one locationApache Total 使用 vhost 重定向到 https 期望一个位置
【发布时间】:2015-01-30 15:27:56
【问题描述】:

如何使用虚拟主机设置将流量重定向到 https 需要一个位置。

我需要有一个位置“http”http://www.example.com/myhttplocation/

<VirtualHost *:80>
    ServerName www.example.com
    Redirect / https://www.example.com/
</VirtualHost >

【问题讨论】:

    标签: linux apache https


    【解决方案1】:

    您可以使用RewriteRule 来执行此操作。

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/myhttplocation
    RewriteRule ^/(.*) https://example.com/$1 [R,L]
    

    将以上内容添加到您的VirutalHost 并确保启用mod_rewrite

    【讨论】:

      猜你喜欢
      • 2021-06-16
      • 2018-05-08
      • 2020-11-01
      • 2021-11-13
      • 2013-06-29
      • 2018-05-12
      • 2016-03-24
      • 2018-05-12
      • 2011-08-18
      相关资源
      最近更新 更多