A
A
Alexander2017-01-18 11:13:38
Laravel
Alexander, 2017-01-18 11:13:38

Why did NotFoundHttpException occur in Laravel?

Help with error: NotFoundHttpException in RouteCollection.php line 161 in Laravel.
Screenshot of the error joxi.ru/eAO0W56Fx6xver
The error appeared after I transferred the project to hosting. On hosting, the project is located in a subfolder, path: site root/laravel-win . There was no such error on the local server, I use openserver, where the project is located in the standard domains folder path: domains/laravel-win
Perhaps I need to make changes to the .htaccess file located in the public folder?
Content of laravel-win/public/.htaccess file:


Options -MultiViews
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}]

Content of laravel-win/.htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

Laravel Version - 5.2.45
awpwp

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrzej Wielski, 2017-01-18
@inviziblll

If the entry point should be along the site.ru/laravel-win path, then all routes must be wrapped in a group with a prefix.

Route::group(['prefix' => 'laravel-win'], function() {
    // Тут ваши роуты
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question