[英]Laravel on Ubuntu with Apache2 not working
我試圖為apache2配置laravel。
但是,如果我打開http:// localhost /,它將重定向到http:// localhost / login ,則無任何顯示。
如果我嘗試使用http://localhost/index.php/login ,則可以使用視圖刀片進行登錄。 但是,如何刪除/index.php/
Apache vHost配置
和“主要”路線
Route::get('/home', function() {
return Redirect::to('login');
});
Route::group([], function() {
Route::get('/', function() {
return Redirect::to('dashboard');
Route::get('galleries', 'GalleryController@getGalleries');
Route::get('galleries/{GID}', 'GalleryController@getPicuteGallery');
Route::get('news', 'NewsController@index');
Route::get('dashboard', 'DashboardController@index');
Route::get('search', 'Search\SearchController@index');
Route::get('calendar', 'CalendarController@index');
Route::get('symposium', 'SymposiumController@index');
Route::get('conference', 'ConferenceController@index');
Route::get('publication', function() {
return view('publication');
});
});
Auth路由由AdminLTE安裝程序預定義。
/**
* Define the AdminLTETemplate routes.
*/
protected function defineRoutes()
{
if (!$this->app->routesAreCached()) {
$router = app('router');
$router->group(['namespace' => $this->getAppNamespace().'Http\Controllers'], function () {
require __DIR__.'/../Http/routes.php';
});
}
}
和AdminLTE路由器
<?php
/*
* Same configuration as Laravel 5.2:
* See https://github.com/laravel/framework/blob/5.2/src/Illuminate /Auth/Console/stubs/make/routes.stub
*/
Route::group(['middleware' => 'web'], function () {
Route::auth();
Route::get('/home', 'HomeController@index');
Route::get('/', function () {
return view('welcome');
});
});
-更新-
我發現未啟用mod_rewrite。 現在,該網站可以正常運行。
但是我需要添加'middleware'=>'web'類
刪除['middleware' => 'web']
從您routes.php
,因為自Laravel 5.2.27這個中間件自動適用於所有的路線,如果你手動添加它,它可能會給你壞了應用程序。
更新:
您有一個將您重定向到“儀表板”的功能(為什么?),並且該功能未關閉。 因此,請嘗試刪除這些行:
Route::get('/', function() {
return Redirect::to('dashboard');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.