Problem routes Laravel

1

I'm using Laravel 5.3 and in the course I'm doing it asks for the routes to put the following line:

Route::get('/produtos', 'ProdutoController@lista');

But putting it like this is an error:

NotFoundHttpException in RouteCollection.php line 161:

To work I have to put:

Route::get('/', 'ProdutoController@lista');

But when putting another page to detail the products does not work more when putting for example:

Route::get('/mostra', 'ProdutoController@mostra');
    
asked by anonymous 31.10.2016 / 19:39

1 answer

0

The error is occurring because the application is reading from the root folder of Laravel and not from the public folder.

If you are using Apache, your application needs to point to the public folder of your Laravel project.

Because Laravel internally uses $_SERVER["REQUEST_URI"] to capture the request, instead of capturing /produtos , it would have to capture /public/produtos .

So, you need to set up your pointing correctly.

For the comment you made, it meant that you have a written application with laravel, however you are trying to access it as sub-folders.

This usually does not work very well, as Laravel has been thinking in order to be rotated in the root.

You can try doing some tricks as below, but that's not a good idea.

Problem with subfolders and url rewrite with Laravel

    
31.10.2016 / 20:33