Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Building Websites with PHP Slim Basics & Twig Templates Routing For Our Project

[RESOLVED] 404 Page Not found... even after it was working on the previous step...

Ok, so I have Slim installed... the whole bit below working just fine as in the video... ..... $app->get('/hello/:name', function () {
echo "Hello, $name"; }); .....

HOWEVER when the instructor moves to the next example... $app->get('/', function () {
echo "Hello, this is the homepage."; });

$app->get('/contact', function () {
echo "Hello, feel free to contact us."; });

$app->run();

I get the 404 error like we were getting before adding the .htaccess file.

So... it was working, and without changing a thing, and following Hampton's teaching... I am getting a 404 error.

Any help / suggestions would be great. Thank you.

2 Answers

So, when in this step in the training .... the last step had '/hello/:name', ... thus my preview url ended with /hello/Brandon... THAT is what I was refreshing ....

HOWEVER.... the training called for us to change to '/', and '/contact' ... So, yeah. If you have this same issue, just clear the /hello and beyond from the url.

I was having the same issue. I figured it out the problem when I happen to glance at the URL.