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
Rob Bailey
3,266 PointsIntroducing Rewrite Rules
The following rewrite rule is in place on my website.
RewriteRule ^flavors/$ flavors/flavors.php
If someone types in this web address, they will see a list of ice cream flavors.
What will the web address that appears in their browser be? (Please specify the absolute path.)
Is it not http://localhost/flavors/flavors.php ?
if not.. what is it!?
4 Answers
Randy Hoyt
Treehouse Guest TeacherThat's the path of the file that will load. But will the address bar have in it? (Remember, the rewrite rule won't redirect to the new address unless you have a [R] flag at the end.)
Does that help?
Rob Bailey
3,266 Pointsahh, gotcha. Makes sense now. THANKS RANDY
Dinakaran K
8,613 PointsWhat are the steps when we got these kind a problems? Thanks and regards
Dinakaran K
8,613 PointsI cant find it I am too tired of trying all methods. Please anyone help to find out.. Thanks.
Ahmed Mohamed
6,631 Pointswhat can't you find? the question is already answered
Dinakaran K
8,613 PointsTell me the steps to find it.. Thanks in advance..
Ahmed Mohamed
6,631 Pointswell...if the rewrite rule is: RewriteRule ^flavors/$ /flavors/flavors.php then you are telling the server ,if the user typed www.yourdomain.com/flavors let him see www.yourdomain.com/flavors/flavors.php but keep the address as it is so he will be seeing this address content www.yourdomain.com/flavors/flavors.php , but in his browser the address will be : www.yourdomain.com/flavors P.S: if you are using localhost and your website is inside of a folder in the localhost you must specify that folder name before the rules so it will be like RewriteRule ^flavors/$ /MyWebsiteFolder/flavors/flavors.php dose this help?
Erika Nielsen
17,556 PointsAS I understand it...Rewrite rules only affect what the server sees. Think about it only changing what is happening behind the scenes.
To get the change in the browser too, you need to add a [R=301] to the end of the reg ex. Like this :RewriteRule ^flavors/$ flavors/flavors.php [R=301].