php - 特定页面始终为 https,而其他一些页面始终为 http

标签 php ssl https

我希望我网站上的一些页面始终为 https,而其他页面始终为 http。

如果有人使用 http://访问 https 页面,他应该被重定向到 https,反之亦然,如果有人使用协议(protocol) https://访问本意为 http://的页面,他应该被重定向到 http版本

最佳答案

使用$_SERVER['HTTPS']检测用户是否已经在 https 连接上,否则使用 301 - 永久移动重定向(所有 future 的请求都应该转到预期的 https URL)。重定向示例为 here .

关于php - 特定页面始终为 https,而其他一些页面始终为 http,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6662342/

相关文章:

python - urllib2 SSL3_CHECK_CERT_AND_算法 : dh key too small

c# - 使用 C# 从 Xamarin 中的 http 网站下载图像

azure - 多域 SSL 证书和 Windows Azure

php - PHP PDO 是否有内置方法以 ID 作为键返回结果作为数组?

php - laravel Redirect::intended() 重定向到完整的 URL

javascript - 使用 google 图表和 Laravel 的自定义工具提示

ssl - PhpMyAdmin 滑动 &lt;style&gt;html{display :none;}&lt;/style&gt; into <head> tag after adding https and cloudflare?

WCF:尝试使用自签名证书和 'PeerTrust' 设置双向双向 SSL 身份验证

ruby-on-rails - 在所有 Rails 助手中将协议(protocol)更改为 https

从 5.2.17 升级到 5.3.27 时引入的 PHP 错误