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!
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
George Drakakis
6,369 PointsCode Chalenge stuck ~ Ever thought of a hint?
in "Adding A Trailing Slash" chalenge you ask
"In an earlier code challenge, we wrote a rewrite rule so that the web page [http://localhost/flavors/] executed the code at [all_flavors.php]. Unfortunately, this only works if the web address includes the trailing slash. If someone visits [http://localhost/flavors], they will see a 404: Page Not Found error. We'll need another rewrite rule to redirect from [/flavors] to [/flavors/]. Add a new line to the htaccess file below to accomplish this."
I answer this:
RewriteEngine On
RewriteRule ^flavors/$ /all_flavors.php
RewriteRule ^(flavors)$ /$1/all_flavors.php
I could right this without the parenthesis and the $1. Problem with those chalenges is that you don't provide any hint in case someone stuck. In my case what the problem?
3 Answers

Ernest Grzybowski
Treehouse Project ReviewerHey George Drakakis
The hint provided in this challenge is not very helpful at all.
If you carefully read the question you see that it wants you to redirect from /flavors
to /flavors/
Start off with:
RewriteRule ^flavors$ /flavors/
and then don't forget to add the 301 redirect
RewriteRule ^flavors$ /flavors/ [R=301]
Hope that helps!

George Drakakis
6,369 PointsI didn't understand the question in the first place, thats why I was stuck.
Anyway, when I say a "hint" I mean that it would be great to provide a help if someone stucks in those kind of challenges. You can remove lot of points to provide that help. :-)

Ernest Grzybowski
Treehouse Project ReviewerYeah, it's not a perfect system yet.
If you have:
RewriteEngine On
RewriteRule ^flavors/$ /all_flavors.php
and hit "Check Work", you get a "Hint" of:
Bummer! Something is not correct in the your htaccess file. Please try again.
but, if you type
RewriteEngine On
RewriteRule ^flavors/$ /all_flavors.php
RewriteRule ^flavors$ /flavors/
and you hit "Check" you still get a hint of:
Bummer! Something is not correct in the your htaccess file. Please try again.
Not too helpful, but they usually are. Maybe Randy Hoyt can update that for future users.

George Drakakis
6,369 Points!!!! Never noticed those kind of hints. Thanks for your answers Ernest.
Robert Harvey
8,065 PointsRobert Harvey
8,065 PointsI don't get this. My code is exactly the same as yours, but it still doesn't work:
RewriteRule ^flavors$ /flavors/ [R=301]
I still get the ultra-helpful message: "Bummer! Try again!"