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 Rewrite Rules with Query Strings

Becky Christofferson
Becky Christofferson
15,047 Points

Adding the shirt conditional gives me a server error of 500 and I can't access any pages.

When I add the conditional, I can no longer access my localhost. Code is below.

RewriteCond %{QUERY_STRING} ^id=([0-9]+)$
RewriteRule ^shirt.php$ /shirts/%1/? [R-301]

Anyone with similar issues?

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi Becky,

The only issue I see is your redirection statement is formatted incorrectly, currently you have an hyphen where an equals sign should be which will cause an internal server error as Apache can't parse it.

RewriteRule ^shirt.php$ /shirts/%1/? [R=301]