apache - 为什么某些 apache 服务器的 htaccess 检测不到 https?

标签 apache .htaccess mod-rewrite ssl https

我经常需要从 https 重定向到 http(或从 http 到 https),但并不是在所有带有 apache 的服务器中都适用此规则:

RewriteCond %{HTTP_X_FORWARDED_PROTO} ^https$ [or]
RewriteCond %{HTTPS} on

什么规则也可以帮助检测 url 是 https?

最佳答案

对于我的主机来说,只有这个常数:

$_SERVER['HTTP_X_HTTPS']

关于apache - 为什么某些 apache 服务器的 htaccess 检测不到 https?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34858488/

相关文章:

linux - Godaddy虚拟主机根目录

mod-rewrite - 我的 URL 的 URL 重写模式

android - 执行apache HttpPost时如何在UrlEncodedFormEntity中将空格编码为%20?

python - Apache mod_wsgi 和 php 在同一个域中

php - mod 重写规则,用于从 url 中搜索字符串并仅替换该 url 的域名

authentication - 除了使用 .htaccess 的文件之外,我如何要求所有文件的密码?

.htaccess 将所有内容重写到父目录

.htaccess - 使用 .htaccess 切换语言

python - apache 后面的扭曲 Web 服务器 - 找不到资源

python - Ubuntu中的nginx和supervisor设置