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 Including & Running Slim

including .htaccess still returning 404 page not found error

I've got a problem with following your course because of stuck on routing issues. The given .htaccess template doesn't work properly as well as the template from slim framework site. Despite it is quite common problem I wasn't able to solve it by searchin forums. Please help!

the uset .htaccess is as follows:

RewriteEngine On

Some hosts may require you to use the RewriteBase directive.

If you need to use the RewriteBase directive, it should be the

absolute physical path to the directory that contains this htaccess file.

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L]

5 Answers

Hi, I am having the same problem. I am going through the course on my local Mac. It is running apache but I seem to have gotten stuck at this point. Any ideas?

Thanks.

Steve

Hi Przemysłąw!

First things first :) Have a few questions for you.

What web server do you use nginx or apache? Can you show their *.conf files, and conf file this site/project?

One thing to note, .htaccess file wont work just by itself. You need web server to handle it properly.

Best regards.

Hi and thanks for response.

I tried it with Treehouse course "Building Websites with PHP" (https://teamtreehouse.com/workspaces/19083832#) which returns simple Page not found message. Then I tried with Apache server (Xampp), and got more sophisticated error https://snag.gy/Ohos2Z.jpg

cheers

Hi Przemysłąw.

I'm sorry for late response. Error explained few things. Can you show me your app.php file?

Joe Scotto
Joe Scotto
8,282 Points

Verify your get method has a "/" after "hello"

$app->get('/hello/:name', function ($name) {
  echo "Hello, $name";
});