Laravel-5重定向循环

时间:2015-05-22 15:38:33

标签: php laravel redirect laravel-5 laravel-routing

我的routes.php是这样的:     

Route::get('deneme/{test}', 'TestController@index');

Route::get('send', 'MailController@index');

Route::get('elfinder/tinymce4', 'Barryvdh\Elfinder\ElfinderController@showTinyMCE4');

Route::group(['middleware' => ['auth', 'perm'], 'prefix' => 'admin'], function(){

    Route::get('/', ['as' => 'admin', 'uses' => 'Admin\DashboardController@index']);

    Route::resource('kategori', 'Admin\KategoriController');
    Route::resource('icerik', 'Admin\ContentController');

    // Property Routes
    Route::resource('property', 'Admin\PropertyController');
    Route::post("property/lang", ['uses' => 'Admin\PropertyController@langAdd', 'as' => 'admin.property.lang_add']);
    Route::get("property/lang/{id}", ['uses' => 'Admin\PropertyController@langDelete', 'as' => 'admin.property.lang_delete']);

    Route::get('users/add', 'Admin\UsersController@add');
    Route::get('content/add', 'Admin\ContentController@add');

});

Route::get('admin/login',['as' => 'admin.get_login', function(){
    return view("admin.login");
}]);
Route::post('admin/login', ['as' => 'admin.do_login', 'uses' => 'Auth\AuthController@postLogin']);
Route::get('admin/logout', ['as' => 'admin.logout', 'uses' => 'Auth\AuthController@getLogout']);

当我向site.dev/admin发送请求时,浏览器会说:

  

此网页有重定向循环

     

ERR_TOO_MANY_REDIRECTS

我删除了旋转并留空了只有PHP标签可用但是这个url -site.dev/admin-返回相同的错误。我测试了2个浏览器,Chrome和Firefox。我认为这个错误源于浏览器缓存和安装的Opera浏览器 - 之前没有安装 - 但仍然会得到相同的错误。

1 个答案:

答案 0 :(得分:3)

我解决了这个问题。在公共文件夹下,存在名称为 admin 的文件夹。所以我改变了我的轮换:

Route::group(['middleware' => ['auth', 'perm'], 'prefix' => 'adminpanel'], function(){

Route::get('/', ['as' => 'admin', 'uses' => 'Admin\DashboardController@index']);

Route::resource('kategori', 'Admin\KategoriController');
Route::resource('icerik', 'Admin\ContentController');

// Property Routes
Route::resource('property', 'Admin\PropertyController');
Route::post("property/lang", ['uses' => 'Admin\PropertyController@langAdd', 'as' => 'admin.property.lang_add']);
Route::get("property/lang/{id}", ['uses' => 'Admin\PropertyController@langDelete', 'as' => 'admin.property.lang_delete']);

Route::get('users/add', 'Admin\UsersController@add');
Route::get('content/add', 'Admin\ContentController@add');

});

新的网址轮播不会与公开文件夹下的任何文件夹冲突。

好作品。