# Cakephp Logout and rederect not working in hostgator

**URL:** <https://discourse.cakephp.org/t/cakephp-logout-and-rederect-not-working-in-hostgator/1979>\
**Category:** Uncategorized\
**Created:** [February 3, 2017, 7:07am UTC](https://discourse.cakephp.org/t/cakephp-logout-and-rederect-not-working-in-hostgator/1979 "2017-02-03T07:07:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryodo](https://avatars.discourse-cdn.com/v4/letter/r/b3f665/32.png) [@ryodo](https://discourse.cakephp.org/u/ryodo)\
**Post date:** [February 3, 2017, 7:07am UTC](https://discourse.cakephp.org/t/cakephp-logout-and-rederect-not-working-in-hostgator/1979/1 "2017-02-03T07:07:18Z")

</div>

Yesterday everything is fine but today the logout function does not work anymore and access to the path / users no longer valid but when I run / users / index its worck here is an explanatory video and my code [https://youtu.be/C-1aUF2I-ac](https://youtu.be/C-1aUF2I-ac)

```
function beforeFilter()
{
    parent::beforeFilter();
    $this->Auth->allow('login','add');

    $this->Auth->authError = __('Vous devez être connecté.');
    $this->Auth->loginError = __('E-mail ou mot de passe invalide, veuillez réessayer');
}
function login()
{
    if ($this->request->is('post'))
    {
        if ($this->Auth->login())
        {
            $this->redirect(array('action' => 'view'));
        }
    }
}
public function logout()
{
    $this->Auth->logout();
    $this->redirect(array('action' => 'login'));
}

public function index() 
{
        $this->paginate = array(
        'limit' => 1000,
        'order' => array(
            'User.id' => 'desc'
        ));
        $this->User->recursive = 0;
        $this->set('users', $this->paginate());
   }
AppController.php

class AppController extends Controller
{
var $components = array('Auth','Session');
function beforeFilter()
{
     //$this->Auth->allow(array('*'));
}
}

```

in my hosting have php 5.6.29 version for cake is 2.3.4
