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

Adam Kempin
Adam Kempin
9,586 Points

Getting: Not Found The requested URL /buildingWebsitesWithPHP/contact was not found on this server.

Getting the error:

Not Found

The requested URL /buildingWebsitesWithPHP/contact was not found on this server.

Whereas the homepage '/' is working fine. Can't work it out, here is my code:

<?php

require 'vendor/autoload.php';

date_default_timezone_set('Europe/London');

// use Monolog\Logger; // use Monolog\Handler\StreamHandler;

$app = new \Slim\Slim();

$app->get('/', function() { echo 'Hello, this is the home page.'; });

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

$app->run();

// $log = new Logger('name'); // $log->pushHandler(new StreamHandler('app.log', Logger::WARNING)); // $log->addWarning('Foo');

?>

Adam Kempin
Adam Kempin
9,586 Points

Worked it out - somehow, I had skipped the creation of the .htaccess file, must have just been resuming the course without having finished the previous video.

Sorry!