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 Enhancing a Simple PHP Application Cleaning URLs with Rewrite Rules Get Variables and Rewrite Rules

.htaccess file will not work apache using xampp Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3 Server at localhost

RewriteEngine On RewriteRule ^shirts/$ /shirts/shirts.php RewriteRule ^shirts/([0-9]+)/$ /shirts/shirt.php?id=$1

when i go to localhost/shirts it still displays the directory with all the files in the browser

4 Answers

Stone Preston
Stone Preston
42,016 Points

is your filed named .htcaccess or .htaccess. it should be .htaccess

i figured it out look like it is suppose to be in the root of the server the video showed it in the shirts folder

This is probably because your regex condition requires an exact match

^shirts/$

is different than

^shirts$

it is .htaccess i just typed it wrong in the form