1

I used the Auth-code that allready is the laravel application. It works fine besides one mistake I wasn't able to find. I created a '/home' route in my routes.php. After some time I removed that route because I didn't needed her anymore.

Now I've got the problem that my website confuse me at every login / logout / register. The first site is the login script. Let's imagine I don't have a account in my DB. So I'm creating a new account. After the register formular I get directed to my ( not in my routes.php existing /home route ).

After that I'm logging out my account and try the login script. Sometimes I'm getting directed to my blog ( how it should be ). But sometimes it's just directing me to the ( still not existing ) /home route. And I really don't know why.. In my routes.php isn't any /home route. I looked into the AuthController / PasswordController and in all files at the Middleware dictionary and haven't found a single view return/redirect to any route called /home.

Does somebody know why I also can search to find the part of the code that directs me to the /home route?

Route::get('/', function(){
    if(Auth::guest())
        return Redirect::to('auth/login');
    else
        return view('test/index');
    });

// Authentication routes...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// Registration routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');
1
  • Please update your question/tags to include the laravel version Commented Feb 25, 2016 at 10:43

1 Answer 1

1

The problem is Laravel 5 is automatically redirect you to /home by default.

Look at AuthController.php and change to this:

protected $redirectTo = '/';

Also, as alternative, you could create some route redirection.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm on my authController. But where should I type: protected $redirectTo = '/';
It's protected $redirectTo = '/home'; by default in most subversions of Laravel 5. It's before __construct method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.