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.


Introducing Rewrite Rules - Only shows directory listing

Hi, I'm using XAMPP with a VirtualHost, but i have tried in htdocs on localhost as well. The code in my .htaccess is:

RewriteEngine On RewriteRule ^shirts/$ /shirts/shirts.php

Any reason why i'm just getting a directory listing with shirt.php, shirts.php ?

  • Thanks
Matthew Madden
Matthew Madden
5,753 Points

Did you find a solution here? I'm seeing the same thing. I have the site files in a subfolder though, which I have tried in the rule without success. I've made sure that the rewrite module is turned on.

2 Answers


Matthew Madden
Matthew Madden
5,753 Points

I didn't have to activate the module, it was already on. I found out by clicking on the wamp icon in the system tray and going to Apache>Apache Modules and then scrolling to find the "rewrite_module" and making sure it was checked.

After messing with the code a bit more, I got this to work (remember I have everything in a subfolder) with the code below.

RewriteEngine On
RewriteRule ^shirts/$ shirts/shirts.php

My joy was short lived as now my redirects (next video) aren't working, but I think I'm okay skipping over that part for now.