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

RewriteRule in EnhancingPhp App gets overridden??

This is my rewrite rule:

RewriteEngine On

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

When i enter one of the rules as URL or click on the corresponding link. In both cases i always get the first site "/shirts/shirts.php".

It seems like it interprets the second RegularExpression as it would fit the first and ignores the "/[0-9]+ part/

How is that possible??

1 Answer

Did you add the condition in shirts/shirt.php (the single shirt page) to return to the shirts/shirts.php (all page) if the ID couldn't be found?

Thank you.... It seems like i included the files on the shirt.php site in the wrong order and had some typo in the products.php.

I did the video again and now it works.