Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Building Websites with PHP Slim Basics & Twig Templates Including & Running Slim

Mostafa Akram
PLUS
Mostafa Akram
Courses Plus Student 9,541 Points

URL still not found Slim

I am working on my local host on my mac

i have done all the steps by adding .htaccess file to the directory of my project

and added the code from Get Started of the Slim Framework v2

and when typing localhost/myproject/hello/name still didn't get anything and receive Not Found on server error

although i have done it on the workspace and it worked fine

Mostafa Akram
Mostafa Akram
Courses Plus Student 9,541 Points

although $app->get('/',function() {}); worked fine but $app->get('/contact',function(){});did not work

itangsanjana
itangsanjana
2,685 Points

Sounds like .htaccess problem. what is your base path? try this inside your get() before return line.

print_r($request->getUri()->getBasePath());

if the path not equal '/' than add RewriteBase /to/your/path in .htaccess.

HTH

PS. I am under Slim 3