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 trialHassanain Anver
4,902 PointsTempting with Twig is giving me an error The requested URL /index.php was not found on this server. PLs HELP!
Im trying to setup my templates for my pages, Ive successfully added the home page
home.twig : This works perfectly. main.twig : this is generating the header, footer and common elements on the home.twig perfectly! index.php is also correctly pointing the pages to it right location.
<?php
$app->get('/', function() use($app){
$app->render('home.twig');
})->name('home');
$app->get('/contact', function() use($app){
$app->render('contact.twig');
})->name('contact');
but when I'm trying to link the /contact page its giving me this error The requested URL /index.php
This is how I've linked the URLs on the main.twig
<?php
<li class="current-menu-parent"><a href="{{ baseUrl() }}" title="">Home</a></li>
<li><a href="{{ siteUrl('/contact')}}">Contact</a></li>
1 Answer
Ted Sumner
Courses Plus Student 17,967 PointsDid you do this in Workspaces? If so, please post a snapshot of your workspace by clicking the camera icon in the upper right side and following the steps until you can copy the URL. Paste the URL here. Otherwise, check to make sure you have the .htaccess file. The problem is often with the URL in the main.twig file so check that. If those do not solve the problem, please post all of the code here.
Ted Sumner
Courses Plus Student 17,967 PointsTed Sumner
Courses Plus Student 17,967 PointsEdited code.