没有页面 - Laravel 5.2

时间:2017-07-29 13:52:39

标签: php laravel laravel-5 laravel-5.2

我从github下载了CMS项目,Laravel 5.2版。我在文件夹中安装了作曲家,并在.env文件中更改了数据库信息,项目工作正常。

但是只有主路线正在工作,其余路线给我“Opps no page avaible”

刀片文件只有路线无效!

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for 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');
});

Route::auth();

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

Route::get('/post/{id}', ['as' => 'home.post', 'uses' => 'AdminPostsController@post']);

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

  Route::get('/admin', ['as' => 'admin.index', function () {
    return view('admin.index');
  }]);

  Route::resource('admin/users', 'AdminUsersController');

  Route::resource('admin/posts', 'AdminPostsController');

  Route::resource('admin/categories', 'AdminCategoriesController');

  Route::resource('admin/medias', 'AdminMediasController');

  Route::resource('admin/comments', 'PostCommentsController');

  Route::resource('admin/comment/replies', 'CommentRepliesController');


});

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

  Route::post('comment/reply', 'CommentRepliesController@createReply');

});

这里是.htaccess文件:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

1 个答案:

答案 0 :(得分:0)

由于此路由是在资源路由之前定义的,因此您的路由将与导致&#34; Opps的资源操作不匹配!没有可用的页面&#34;。

我认为在资源路径定义之后移动该路线定义可以解决您的问题。

尝试一下&amp;如果这一点得到解决,请告诉我们。