我在apache服务器配置中设置了ProxyPass
。
PHP似乎无法检测到HTTPS。
如果不是.htaccess中的HTTPS,我如何检测PHP中的HTTPS或重定向?
Apache配置:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName domain.co.uk
ServerAlias www.domain.co.uk
ProxyPass / http://external-domain.com/
Include /etc/letsencrypt/options-ssl-apache.conf
...
</VirtualHost>
</IfModule>
答案 0 :(得分:2)
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
答案 1 :(得分:0)
如果你使用HTTPS,这将检查PHP。
if(!empty($_SERVER["HTTPS"])) {
}