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

Sergey Podgornyy
Sergey Podgornyy
20,660 Points

Can't direct visit "Hello" page from url

I created .htaccess file, but still can't directly visit a page as localhost/hello/sergey

I can visit it only if type localhost/index.php/hello/sergey in adress bar.

2 Answers

Tommy Choe
Tommy Choe
38,156 Points

Hey Sergey, I'm not an expert on php but I'll try to help you out as best as I can. I found a stack overflow discussion that has a possible answer to your problem. It has to do with writing a few lines inside of the .htaccess file.

http://stackoverflow.com/questions/4365129/htaccess-remove-index-php-from-url

Let me know if this works for you.

Sergey Podgornyy
Sergey Podgornyy
20,660 Points

Thanks, bro ;)

I checked all answers and found the best one for my problem)

Sergey Podgornyy
Sergey Podgornyy
20,660 Points

I also enable mod_rewrite in Ubuntu. Here is a link - http://www.dev-metal.com/enable-mod_rewrite-ubuntu-14-04-lts/ Maybe someone also will find it useful.

Tommy Choe
Tommy Choe
38,156 Points

No problem Sergey, glad I could help!

GAURAV DOBHAL
GAURAV DOBHAL
6,155 Points

Sergey Podgornyy Hey Sergey I am struggling with the same issues. Have gone tried almost everything but still giving errors. I can visit a page only as localhost/index.php/hello/gaurav and not directly localhost/hello/gaurav
I am working with MAMP on a Mac (EL Captain). Will appreciate all the help. Thank you so much