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

Stuck on regular expression challenge in the PHP task.

I need a RewriteRule to to redirect from /flavors to /flavors/ ensuring that if the trailing slash is left off the user doesn't get a 404 error. I'm absolutely hopeless at regular expressions and cant work out how this should look. I have the below in the .htaccess file:

RewriteEngine On
RewriteRule ^flavors/$ /all_flavors.php RewriteRule ^flavors/$ /$1/ [R=301]

in the prior video the below was used, so i know it should be similar, but its a little different as we are not looking an numbered query string values in the URL and im just not sure how the rule should look.

RewriteRule ^(treehouse/php/shirts/[0-9]+)$ /$1/ [R=301]