gpt4 book ai didi

cakephp - 在 cakephp 中对某些页面强制使用 https

转载 作者:行者123 更新时间:2023-12-02 16:00:39 26 4
gpt4 key购买 nike

当我到达网址 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]

关于cakephp - 在 cakephp 中对某些页面强制使用 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16942472/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com