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 trialErin Avery
7,603 PointsWhy cover renaming all pages to index.php and then the Rewrite rules? Aren't they the same result? Is one way better?
I have a website I am working on that has about 50 pages so it seems that the rewrite rules are more efficient than having 50 index.phps in their own folders, but then why was that approach taught? Is there some circumstance where it is preferable?
1 Answer
Jeff Lemay
14,268 PointsWith a case like yours where the site is already built, you're probably better off using rewrite.
I think in all lessons, they try to only teach you certain information at certain times. So when we originally build the site, we have file names like about.html. Then we move to about.php. Then we want to clean-up the filenames, which isn't necessary but makes URLs much nicer, so we move files into individual folders and change filenames to index.
Then, whenever we create our own sites/projects, we'll skip straight to putting index.php inside individual folders.