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

PHP Enhancing a Simple PHP Application Cleaning URLs with Rewrite Rules Introducing Rewrite Rules

.htaccess

which one is correct? if we want to make all_flavors act as index.php in flavors folder RewriteEngine On RewriteRule ^flavors/$ /all_flavors.php ---- OR ----- RewriteEngine On RewriteRule ^flavors/$ /flavors/all_flavors.php

2 Answers

Spenser Hale
Spenser Hale
20,915 Points

Option 1) RewriteRule ^flavors/$ /all_flavors.php

will take url: domain.tld/flavors/ to domain.tld/all_flavors.php

Option 2) RewriteRule ^flavors/$ /flavors/all_flavors.php

will take url: domain.tld/flavors/ to domain.tld/flavors/all_flavors.php

So it depends where you have your all_flavors.php file.

thank you spenser