强制https用于cakephp中的某些页面
发布时间:2020-12-13 22:48:59 所属栏目:PHP教程 来源:网络整理
导读:当我到达网址http://www.example.com/payments/add/2时,它会自动重定向到https://www.example.com/payments/add/2. 注意:我在服务器上安装了ssl. if($this-params['action']=='add' $this-params['controller']=='payments') { $this-redirect('https://' .
当我到达网址http://www.example.com/payments/add/2时,它会自动重定向到https://www.example.com/payments/add/2.
注意:我在服务器上安装了ssl. if($this->params['action']=='add' && $this->params['controller']=='payments') { $this->redirect('https://' . env('SERVER_NAME') . $this->here); } 那段代码不起作用.请帮忙 解决方法
试试这个
Options +FollowSymlinks RewriteEngine On RewriteBase / #redirect www.mydomain.com to mydomain.com (or any other subdomain) RewriteCond %{HTTP_HOST} !^mydomain.com$[NC] RewriteRule ^(.*)$http://mydomain.com/$1 [L,R=301] #force https for certain pages RewriteCond %{HTTPS} !=on RewriteRule ^(page1.php|page2.php|page3.php|page4.php)$https://%{HTTP_HOST}%{REQUEST_URI} [L,R] (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |