gpt4 book ai didi

SSL蛋糕PHP表单

转载 作者:太空宇宙 更新时间:2023-11-03 14:34:36 26 4
gpt4 key购买 nike

我在 https 中访问了该网站,我有 2 个问题,该网站已重定向,但它是 301 重定向吗?我没有在 .htaccess 文件中写任何东西,为什么网站会在 https 中重定向?我害怕重复的内容。

我的问题是电子邮件不再有效......这是代码:

public function initialize()
{
parent::initialize();
$this->loadComponent('Security', ['blackHoleCallback' => 'forceSSL']);
$this->loadComponent('RequestHandler');
$this->loadComponent('Flash');
$this->loadComponent('Auth', [
'authenticate' => [
'Form' => [
'fields' => [
'username' => 'email',
'password' => 'password'
],
'finder' => 'auth'
]
],
'loginAction' => ['controller' => 'Users', 'action' => 'login', 'prefix' => 'manager'],
'loginRedirect' => ['controller' => 'Pages', 'action' => 'index', 'prefix' => 'manager'],
'logoutRedirect' => ['controller' => 'Users', 'action' => 'login', 'prefix' => 'manager'],
// 'authorize' => 'Controller'
]);
}

public function forceSSL()
{
return $this->redirect('https://' . env('SERVER_NAME') . $this->request->here);
}

public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
$this->Security->requireSecure();
$this->checkManager();

$this->set('settings', Configure::read('Settings'));
}

谢谢

最佳答案

解决方法如下:

public function initialize()
{
parent::initialize();
$this->loadComponent('Security', ['blackHoleCallback' => 'forceSSL']);
}

public function forceSSL()
{
return $this->redirect('https://' . env('SERVER_NAME') . $this->request->here);
}

public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
$this->Security->requireSecure();
$this->Security->config('unlockedActions', ['contact']);
}

和:

在 Controller.php 中更改状态

公共(public)函数重定向($url, $status = 302)

变成:

公共(public)函数重定向($url, $status = 301)

关于SSL蛋糕PHP表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49199161/

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