2016-03-21 37 views
-2

我用make命令:AUTH而事實證明:Laravel5使:AUTH不起作用

Created View: /var/www/myblog/resources/views/auth/login.blade.php 
Created View: /var/www/myblog/resources/views/auth/register.blade.php 
Created View: /var/www/myblog/resources/views/auth/passwords/email.blade.php 
Created View: /var/www/myblog/resources/views/auth/passwords/reset.blade.php 
Created View: /var/www/myblog/resources/views/auth/emails/password.blade.php 
Created View: /var/www/myblog/resources/views/layouts/app.blade.php 
Created View: /var/www/myblog/resources/views/home.blade.php 
Created View: /var/www/myblog/resources/views/welcome.blade.php 
Installed HomeController. 
Updated Routes File. 
Authentication scaffolding generated successfully! 

看起來很好,我得到了正確顯示了一個主頁。 see picture here

但是當我試圖訪問登錄和註冊頁面時,出現了一些問題。 它給了我這樣的錯誤:

Not Found 

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

Apache/2.4.7 (Ubuntu) Server at ... 

和我打的PHP工匠路線:名單終端,我得到這個:

+--------+-----------+-------------------------+-----------------+-----------------------------------------------------------------+------------+ 
| Domain | Method | URI      | Name   | Action               | Middleware | 
+--------+-----------+-------------------------+-----------------+-----------------------------------------------------------------+------------+ 
|  | GET|HEAD |/      |     | Closure               |   | 
|  | GET|HEAD | article     | article.index | App\Http\Controllers\[email protected]     |   | 
|  | POST  | article     | article.store | App\Http\Controllers\[email protected]     |   | 
|  | GET|HEAD | article/create   | article.create | App\Http\Controllers\[email protected]     |   | 
|  | DELETE | article/{article}  | article.destroy | App\Http\Controllers\[email protected]     |   | 
|  | PUT|PATCH | article/{article}  | article.update | App\Http\Controllers\[email protected]     |   | 
|  | GET|HEAD | article/{article}  | article.show | App\Http\Controllers\[email protected]      |   | 
|  | GET|HEAD | article/{article}/edit | article.edit | App\Http\Controllers\[email protected]      |   | 
|  | GET|HEAD | home     |     | App\Http\Controllers\[email protected]      | web,auth | 
|  | GET|HEAD | login     |     | App\Http\Controllers\Auth\[email protected]   | web,guest | 
|  | POST  | login     |     | App\Http\Controllers\Auth\[email protected]     | web,guest | 
|  | GET|HEAD | logout     |     | App\Http\Controllers\Auth\[email protected]     | web  | 
|  | POST  | password/email   |     | App\Http\Controllers\Auth\[email protected] | web,guest | 
|  | POST  | password/reset   |     | App\Http\Controllers\Auth\[email protected]    | web,guest | 
|  | GET|HEAD | password/reset/{token?} |     | App\Http\Controllers\Auth\[email protected]  | web,guest | 
|  | GET|HEAD | register    |     | App\Http\Controllers\Auth\[email protected] | web,guest | 
|  | POST  | register    |     | App\Http\Controllers\Auth\[email protected]    | web,guest | 
+--------+-----------+-------------------------+-----------------+-----------------------------------------------------------------+------------+ 

這是從我的期望有點不同。因爲我在laracast.com學到的東西,路由列表應該像「Auth \ login」而不僅僅是「登錄」... Idk這裏有什麼問題,是因爲我使用的是Apache嗎?或其他配置我沒有正確設置...尋求幫助

另外一個問題: 當我訪問www.mydomain.com,我希望默認的歡迎頁面,而不是auth的主頁,但實際上它改爲將auth的主頁提供給我。但是當我試圖訪問www.mydomain.com/home時,我希望再次看到該主頁,而我收到了404個未找到的錯誤,這使我很困惑。這裏是我的routes.php:

<?php 

/* 
|-------------------------------------------------------------------------- 
| Routes File 
|-------------------------------------------------------------------------- 
| 
| Here is where you will register all of the routes in an application. 
| It's a breeze. Simply tell Laravel the URIs it should respond to 
| and give it the controller to call when that URI is requested. 
| 
*/ 

Route::get('/', function() { 
    return view('welcome'); 
}); 
/* 
|-------------------------------------------------------------------------- 
| Application Routes 
|-------------------------------------------------------------------------- 
| 
| This route group applies the "web" middleware group to every route 
| it contains. The "web" middleware group is defined in your HTTP 
| kernel and includes session state, CSRF protection, and more. 
| 
*/ 

Route::resource('article', 'ArticleController'); 

Route::group(['middleware' => 'web'], function() { 
    Route::auth(); 

    Route::get('/home', '[email protected]'); 
}); 

回答

1

嗨,夥計們,我剛剛解決了這個問題。

此問題與laravel無關,完全是由Apache2設置引起的。

我所做的只是 sudo a2enmod改寫 並重新啓動服務。

相關問題