Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 2 years ago.
0

I'm also very new to laravel, but wouldn't your url also have to include the id to match the route. What does http://localhost/newlaravel/public/cats/1 show you?

Last updated 2 years ago.
0

The slash before cats is missing in your example. Try this:

Route::get('/cats/{id}', function($id){ return "Cat #$id"; });
Last updated 2 years ago.
0

http://localhost/newlaravel/ -> incorrect because laravel uses /public dir as starting point

http://localhost/newlaravel/public // Shows you have arrived -> that is correct

http://localhost/newlaravel/public/cats //not work -> that is because you specified a parameter on your route. /cats/1 would be correct. Or anything really in this example.

This would return Cat #1, but if you specified /cats/something-else it would return Cat #something-else

Last updated 2 years ago.
0

Have you enabled .htaccess files ?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

dlash02 dlash02 Joined 10 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.