我试图为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');
});
});
--- --- UPDATE
我发现mod_rewrite没有启用。现在网站运行正常。
但我需要添加'middleware'=&gt; '网络课'
答案 0 :(得分:0)
从您['middleware' => 'web']
移除routes.php
,因为自Laravel 5.2.27起,此中间件会自动应用于您的所有路由,如果您手动添加它,则可能会让您破解应用。< / p>
更新:
您有一项功能可将您重定向到仪表板&#39; (为什么?)而且功能也没有关闭。所以尝试删除这些行:
Route::get('/', function() {
return Redirect::to('dashboard');