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 trialMatthew Notter
5,335 PointsCode challenge isn't working properly
This code challenge changes the way apache reads and directs files, such as how regularly apache will open the index.php/.html file first in a folder..
this is accessing that rule through .htaccess.
its telling me to change the direction when you open "http://localhost/flavors/" to open up "http://localhost/flavors/all_flavors.php"
the error with this challenge is it doesn't recognize when I put the "^" and "&" characters at the beginning and end of the target folder (flavors/).
the code I have in .htaccess is:
RewriteEngine On RewriteRule ^flavors/& /flavors/all_flavors.php
the current challenge is just to have:
RewriteEngine On RewriteRule ^flavors/&
but it won't accept anything, I went back into the video and copied the code word for word making sure I was correct and I was but it doesn't seem to work correctly, which has been slightly frustrating..
Let me know if I'm putting a general error that I'm not noticing, I'm pretty confident the code is right and the issue is the challenge, but I'm willing to challenge my code if someone thinks I'm making the error
RewriteEngine On
RewriteRule ^flavors/& /flavors/all_flavors.php
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi Matthew,
You want to end your pattern in the first part of the rule with a dollar sign, not an ampersand.
Also, "all_flavors.php" is not in the "flavors" subfolder. It's in the root htdocs folder.
Try making those changes and post back with updated code if you're still stuck.
Matthew Notter
5,335 PointsMatthew Notter
5,335 PointsYes that worked, that was embarrassing.