http-redirectcakephpbefore-filter

CakePhp Can´t Redirect beforeFilter


I am making a website with a backoffice login and register page. I am using UsersController and PostsController and I can´t access my main page website because it redirects me to my login page. I made a before filter and placed in UsersController:

use Cake\Event\Event;

public function beforeFilter(Event $event){
            $this->Auth->allow(['register', 'home']);
        }

Solution

  • Add this in PostsController.php

    public function beforeFilter(Event $event){
        $this->Auth->allow(['home']);
    }