How to add Laravel route

- 1 answer

Ad

Crated laravel project using below command

composer create-project --prefer-dist laravel/laravel blog

successfully created blog project "http://localhost/blog/public/" after that added below code in "routes.php" file

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

but after that when i type "http://localhost/blog/public/about" its displaying 404 page.

if anyone have any idea please share with me

Ad

Answer

Ad

Well I don't know how you serve the application, apache, nginx or php simple serving.

Lets start from here:

  1. List item
  2. open terminal
  3. go to project folder (where the "artisan" file is located)
  4. run: "php artisan serve"
  5. open in the browser -> "http://localhost:8000"
  6. you suppose to see laravel welcome page
  7. now go to -> "http://localhost:8000/about"
  8. now again you suppose to see laravel welcome page
Ad
source: stackoverflow.com
Ad