Emanuele Lucchese
Emanuele Lucchese

Reputation: 19

Why is the route not recognized in laravel?

I created a project locally and tried to upload it to a free hosting service called altervista.org. If I call the main page it works correctly while if I call another page it gives me http 404 error.

Link to the main page
Link to a secondary page

The code of web.php

Route::get('/', function () {
    return view('welcome');
});

Route::get('/firstpage', function () {
    return "Hello in firstpage";
});

Can anyone help me?

Upvotes: 1

Views: 162

Answers (1)

Nicolas
Nicolas

Reputation: 894

Laravel doesn't work out of the box on sub folders. In order to get it working as-is, you have to host it on your document root (http://matchreferee.altervista.org/). If that's not possible, you can search on how to host laravel on a sub folder.

Upvotes: 2

Related Questions