1
votes

I'm a beginner in frame work Laravel, I'm using Laravel 5.3 - I created a new project - laravel-. - It run fine on URL "http://localhost/laravel/public/" - I added a new route called "home" in web.php file as:

<?php
Route::get('/', function () {
    return view('welcome');
});
Route::get('/home', function () {
    return 'This is home.';
});

Not Found The requested URL /laravel/public/home was not found on this server.

Where is the problem? thank you.

4

4 Answers

3
votes

In development phase the easy way around is using "php artisan serve" command. After you deploy the project, you should configure your server's document root as Alexey suggested.

3
votes

You're using wrong configuration. You should point web server to a public directory:

DocumentRoot "/path_to_laravel_project/public"
<Directory "/path_to_laravel_project/public">

And then use normal URLs like:

http://localhost
http://localhost/home
0
votes

try

Route::get('/home', function () {
    return 'This is home.';
});

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

Also call it like

http://localhost/laravel/home
0
votes

Changing the .env.example file in the root project folder to .env worked for me.

Then generate a new APP_KEY using php artisan key:generate