Cakephp索引在app / webroot中

时间:2013-09-01 21:41:20

标签: php cakephp

我刚刚为我新创建的蛋糕项目添加了ACL权限。但是,当我尝试访问它以创建groupsusers时,我收到以下消息:

Forbidden
You don't have permission to access /Udlejning/app/webroot 

这是仅索引的错误消息,即localhost/Udlejning/

有谁能告诉我为什么要重定向我以及如何解决它?

值得一提的是,我的用户控制器中有以下规则:

  public function beforeFilter() {
    parent::beforeFilter();

    // For CakePHP 2.0
    $this->Auth->allow('*');

    // For CakePHP 2.1 and up
    $this->Auth->allow();
}

我的AppController看起来像这样:

   public function beforeFilter() {
    //Configure AuthComponent
    $this->Auth->loginAction = array('controller' => 'Users', 'action' => 'login');
    $this->Auth->logoutRedirect = array('controller' => 'Users', 'action' => 'login');
    $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'index');
}

这些是我的重定向规则

    <IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

功能

我正在使用Cake 2.4和Linux mint

1 个答案:

答案 0 :(得分:1)

尝试在调用父函数

之前设置auth-&gt; allow
public function beforeFilter() {

 // For CakePHP 2.0
 $this->Auth->allow('*');

 // For CakePHP 2.1 and up
 $this->Auth->allow();

 parent::beforeFilter();

}