我的Apache2.5.3应用程序生活在一个子域中( CakePHP /project_name),而且apache重写规则工作正常。
在我在app/Config/core.php中设置App.fullBaseUrl='domain/project_name‘之后,路由器::fullBaseUrl()工作良好,但是,所有的$this->Controller->重定向和所有AuthComponent重定向到name/controller/action。
有没有其他人遇到过这种情况,你是如何解决的?
事先非常感谢!
发布于 2015-04-27 09:41:54
--这是注销后重定向的模式:
// app/Controller/AppController.php
class AppController extends Controller {
//...
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array(
'controller' => 'posts',
'action' => 'index'
),
'logoutRedirect' => array( // <-- Let's focus at here.
'controller' => 'pages',
'action' => 'display',
'home'
),
'authenticate' => array(
'Form' => array(
'passwordHasher' => 'Blowfish'
)
)
)
);
public function beforeFilter() {
$this->Auth->allow('index', 'view');
}
//...
}来源:http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html#authentication-login-and-logout
在问题上下文中,检查logoutRedirect配置数组。
如果您希望通过其他方式重定向句柄,则为:
public function logout() {
return $this->redirect($this->Auth->logout());
}来源:http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html#authentication-login-and-logout
https://stackoverflow.com/questions/29690476
复制相似问题