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
.htaccess RewriteRule not working as expected
I must not be understanding the question. It appears to be asking for a RewriteRule redirecting someone from localhost/flavors (no trailing slash) to localhost/flavors/ (with trailing slash). Here's what I've tried, but apparently none are correct:
RewriteRule ^flavors$ /flavors/ or RewriteRule (^flavors$) /$1/ or RewriteRule ^flavor$ /all_flavors.php (copying the redirect from the previous line)
What am I missing that is being asked?
RewriteEngine On RewriteRule ^flavors/$ /all_flavors.php RewriteRule ^flavors$ /flavors/
I figured it out. I wasn't adding a redirect flag to the line. The actual code should have been:
RewriteRule ^flavors$ /flavors/ [R=301]
Could you move your comment as answer this way we can mark it as best answer ?