简体   繁体   English

HTTPS请求PHP / ZF 1.11

[英]HTTPS requests PHP/ ZF 1.11

I need to implement a setting secure browsing to my site. 我需要对我的网站实施设置安全浏览。 I have SSL certificate for my site and I want it should work for both HTTP and HTTPS requests based on the user setting. 我的网站拥有SSL证书,并且我希望它可以根据用户设置适用于HTTP和HTTPS请求。 If user selects secure browsing it should redirect with HTTPS protocol only though if any one remove https manually in url like facebook. 如果用户选择安全浏览,则仅当有人在facebook之类的网址中手动删除https时,才应使用HTTPS协议重定向。

Add this to your bootstrap file 将此添加到您的引导文件

protected function _initForceSSL() {
 if($_SERVER['SERVER_PORT'] != '443') {
  header('Location: https://' . $_SERVER['HTTP_HOST'] . 
            $_SERVER['REQUEST_URI']);
  exit();
}

and for detail 和详细

or you can also use for some pages 或者您也可以使用某些页面

https request on some pages but not on all pages zend framework 在某些页面上但不是在所有页面上都使用https请求zend Framework

i am not associated with above link for any firm 我没有与任何公司的上述链接相关联

hope this will sure work for you. 希望这对您一定有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM