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

Derek Dawes
Derek Dawes
4,944 Points

Rewrite on .htaccess not changing get id to a "/"

Hello once again,

I added the code per the instructions and can't seem to get the get id to leave the url. Here's my .htaccess code.

RewriteEngine On
RewriteBase /shirts4mike_local/

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

Here's what outputs to the browser when I select a shirt in the /shirts/ page

http://localhost/shirts4mike_local/shirts/shirt.php?id=103

the id didnt change to shirts/shirt/103 like the video is teaching. Thank you Im using WAMP

I'm having the same problem as you Derek. The rewrite works for the Apache redirect to shirts.php but my URL after the change to shirt.php is still : http://localhost/shirts/shirts.php?id=101.

Here is my .htaccess doc

RewriteEngine On

RewriteRule ^shirts/$ /shirts/shirts.php

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

I'm on a Macbook so I'm using MAMP for my local host.