Problem Routes Laravel

Asked

Viewed 745 times

1

I’m using the Laravel 5.3 and in the course I’m doing asks for on the Routes put the following line:

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

But putting it that way is a mistake:

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 no longer works when putting for example:

Route::get('/mostra', 'ProdutoController@mostra');
  • Are you trying to access the route correctly? Which link you call?

  • Htaccess is just right?

  • I’m accessing : http:/localhost/stock/public/ and it accesses the product list. But to call the product details you need to put: Route::get('/', 'Productocontroller@lista'); losing access to the list method. What is not working is to put the '/products in the get'. htaccess is the default, I haven’t changed anything.

  • You are wrong! You should not access the public folder. public is the root of the application written in Laravel.

1 answer

1

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

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

Because as Laravel internally uses the $_SERVER["REQUEST_URI"] to capture the requisition, rather than capture it /produtos, he would have to capture /public/produtos.

So it is necessary that you properly configure the note.

From the comment you made, it implied that you have an application written with Windows, but you are trying to access it as subfolders.

This usually doesn’t work very well, because Laravel was thinking in a way to be rotated at the root.

You can try to do some tricks like below, but it’s not a good idea.

Subfolder problem and url rewriting with Laravel

  • The problem is that the Laravel is not working properly. When accessing localhost:8000 it gives the error: Fatalthrowableerror in Encrypter.php line 73: Call to Undefined Function openssl_encrypt() I saw this error here but everything I did did not work

  • "The Laravel is not working properly" is an incorrect statement. In fact, you have not configured PHP correctly. You need to enable the module ssl. But this was not described in the question before, so I suggest you ask a new question, not to change the context of the current.

  • Actually the required modules were all installed. I formatted the computer and worked normally.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.