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.

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.