Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel 5 /auth/login not found

Tags:

php

laravel

I've made some change in routes.php and rest configuration is default. routes.php is as follows:

//Route::get('/', 'WelcomeController@index');

Route::get('/', 'HomeController@index');

Route::controllers([
    'auth' => 'Auth\AuthController',
    'password' => 'Auth\PasswordController',
]);

Output of php artisan route:list is

+--------+--------------------------------+-------------------------------------------------------+------+------------------------------------------------------------+------------+
| Domain | Method                         | URI                                                   | Name | Action                                                     | Middleware |
+--------+--------------------------------+-------------------------------------------------------+------+------------------------------------------------------------+------------+
|        | GET|HEAD                       | /                                                     |      | App\Http\Controllers\HomeController@index                  | auth       |
|        | GET|HEAD                       | auth/register/{one?}/{two?}/{three?}/{four?}/{five?}  |      | App\Http\Controllers\Auth\AuthController@getRegister       | guest      |
|        | POST                           | auth/register/{one?}/{two?}/{three?}/{four?}/{five?}  |      | App\Http\Controllers\Auth\AuthController@postRegister      | guest      |
|        | GET|HEAD                       | auth/login/{one?}/{two?}/{three?}/{four?}/{five?}     |      | App\Http\Controllers\Auth\AuthController@getLogin          | guest      |
|        | POST                           | auth/login/{one?}/{two?}/{three?}/{four?}/{five?}     |      | App\Http\Controllers\Auth\AuthController@postLogin         | guest      |
|        | GET|HEAD                       | auth/logout/{one?}/{two?}/{three?}/{four?}/{five?}    |      | App\Http\Controllers\Auth\AuthController@getLogout         |            |
|        | GET|HEAD|POST|PUT|PATCH|DELETE | auth/{_missing}                                       |      | App\Http\Controllers\Auth\AuthController@missingMethod     | guest      |
|        | GET|HEAD                       | password/email/{one?}/{two?}/{three?}/{four?}/{five?} |      | App\Http\Controllers\Auth\PasswordController@getEmail      | guest      |
|        | POST                           | password/email/{one?}/{two?}/{three?}/{four?}/{five?} |      | App\Http\Controllers\Auth\PasswordController@postEmail     | guest      |
|        | GET|HEAD                       | password/reset/{one?}/{two?}/{three?}/{four?}/{five?} |      | App\Http\Controllers\Auth\PasswordController@getReset      | guest      |
|        | POST                           | password/reset/{one?}/{two?}/{three?}/{four?}/{five?} |      | App\Http\Controllers\Auth\PasswordController@postReset     | guest      |
|        | GET|HEAD|POST|PUT|PATCH|DELETE | password/{_missing}                                   |      | App\Http\Controllers\Auth\PasswordController@missingMethod | guest      |
+--------+--------------------------------+-------------------------------------------------------+------+------------------------------------------------------------+------------+

When I access the site via http://laravel/ I get

The requested URL /auth/login was not found on this server.

but if I use http://laravel/index.php/auth/login it works without any error. What is wrong with my routing?

I am using WAMP on windows 7 64-bit.

like image 377
Nagesh Kinge Avatar asked May 10 '15 16:05

Nagesh Kinge


People also ask

Where to find auth Laravel?

Your application's authentication configuration file is located at config/auth. php . This file contains several well-documented options for tweaking the behavior of Laravel's authentication services.

How auth:: attempt work in Laravel?

The controller creates the user and saves it into the database. Then it redirects the user, who is not yet authenticated, to the login route. The postLogin method gets triggered, but this time with no request data. As a result, Auth::attempt($credentials) fails and you get that nasty Failure on screen.

What is attempt() in Laravel?

The attempt method accepts an array of key / value pairs as its first argument. The password value will be hashed. The other values in the array will be used to find the user in your database table. So, in the example above, the user will be retrieved by the value of the email column.


4 Answers

In my project, I had to add the following instruction to Apache configuration:

<Directory /var/www/html/checkin>
AllowOverride All
</Directory>
like image 62
Julien Avatar answered Oct 17 '22 01:10

Julien


You need to enable mode_rewrite for apache.I solved this problem following this blog
http://www.kingpabel.com/apache-mod_rewrite/

like image 6
Imtiaz Pabel Avatar answered Oct 16 '22 23:10

Imtiaz Pabel


Apache mod_rewrite

//enable mod rewrite
a2enmod rewrite

//restart apache
service apache2 restart
like image 5
Moode Osman Avatar answered Oct 17 '22 01:10

Moode Osman


Without apache, You can test it with php artisan serve. Before you need to do some changes in .env, change APP_ENV to local. then browse auth\login, check the error. In my case the error is : PDO not found. Hope this might help.

like image 4
Магнайбаяр Ганзориг Avatar answered Oct 17 '22 01:10

Магнайбаяр Ганзориг