Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8561387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:29:29+00:00 2026-06-11T16:29:29+00:00

In cakephp2.0, I have domain.com but when I logout (url is domain.com/logout ), it

  • 0

In cakephp2.0, I have domain.com but when I logout (url is domain.com/logout), it is redirected to domain.com/app/login. I dont want it to redirect to domain.com/app/login but instead redirect to domain.com/logout. These are the codes I have in my UsersController & my AppController

class AppController extends Controller {
public $helpers = array ('Html', 'Form', 'Js' => array('Jquery'), 'Session');

public $components = array(
    'Session',
    'Auth' => array(
        'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
        'logoutRedirect' => array('controller' => 'users', 'action' => 'login'),
         'authorize' => array('Controller') // Added this line
    )
);
}

Userscontroller

class UsersController extends AppController {
public $components = array(

    'Auth' => array(
        'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
        'logoutRedirect' => array('controller' => 'users', 'action' => 'login'),
         'authorize' => array('Controller') // Added this line
    )
);

public function beforeFilter() {
    parent::beforeFilter();
    $this->Auth->allow('add', 'logout', 'login');
    $this->Auth->deny('view');
}

public function login() {
    if ($this->request->is('post')) {
        if ($this->Auth->login()) {

            $this->redirect('http://domain.com/thankyou');
        } else {
            $this->Session->setFlash(__('Invalid username or password, try again'));
        }
    }
}

public function logout() {
    $this->redirect($this->Auth->logout());
}
}

Any help would be great. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:29:31+00:00Added an answer on June 11, 2026 at 4:29 pm

    I ended up using this in my logout() function

    $this->Auth->logout();
    $this->redirect(some url);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a cakePHP app working at http://domain1.com/domain2 , and want to point http://domain2.com/
I would like to have a url that is domain.com/Test/index route to the same
I have a domain say http://www.testexample.com . When I login to http://www.testexample.com and come
I want to have cakephp paginate data and still use containable , but for
I have a cakephp2 app and the controllers are getting really big. Is there
Let's say I have an SSL secured domain at secure.domain.com. I also have a
I am using apache on Centos and whenever I use domain.com it gets redirected
I have one domain on godaddy (www.mydomain.com). I have placed my cakephp application on
I have two cakephp2 applications running on same database, but having different Auth tables
I have cakephp installed in the root directory. site.com/ i want to install wordpress

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.