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 trialJack Blankenship
Full Stack JavaScript Techdegree Graduate 39,036 PointsStuck on Code Challenge: Adding a Trailing Slash
Challenge task 1 of 1 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.
RewriteEngine On
RewriteRule ^flavors/$ /all_flavors.php
RewriteRule ^/flavors$ /flavors/ [R=301]
The second RewriteRule is what i have added and it looks correct. I have tried this challenge using Chrome and Safari on Mac OS X 10.9.2. The rule works on my localhost.
1 Answer
Logan R
22,989 PointsRemove the / before your ^ and it will work :)
RewriteRule ^flavors$ /flavors/ [R=301]
To a lot of web servers, /flavors and flavors are two different places. One is an absolute path, the other is a relative path.
Jack Blankenship
Full Stack JavaScript Techdegree Graduate 39,036 PointsJack Blankenship
Full Stack JavaScript Techdegree Graduate 39,036 PointsThanks. that got me past the challenge.
Logan R
22,989 PointsLogan R
22,989 PointsGlad it helped you out :) If you have any further questions, feel free to post them on the forums!