mod_rewrite or flat_file - which is more efficient?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Outlander
Forum Newbie
Posts: 4
Joined: Fri Oct 17, 2008 8:26 am

mod_rewrite or flat_file - which is more efficient?

Post by Outlander »

Hi, I am in the early stages of developing a web app in PHP/MySQL. It is predominantly procedural in coding style (with type of MVC approach), though I do have some classes included().

ATM, I have my navigation links going straight to a bare-bones file that sets up variables for that page, and contains variables such as: $pageAuthLevel, $metaPageTitle, $metaPageContent, $metaPageKeywords. Also defined in this page is the include() paths for the actual html content file, the page's controller and lastly the page view.

I know I could include all this data in a MySQL db table and pull info from within the controller.

The advantage of doing it the way I have it currently, is that the links are already written in an SEO friendly manner eg: /about-this-site.php and saves me from having to learn and setup mod_rewite in an .htaccess file. The disadvantage is that I have an additional file for every 'content' file, but the filesize is small and disk space is cheap.

My question is: which way is more efficient in terms of performance, scalability and security, using files that are SEO friendly OR mod_rewrite plus MySQL?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: mod_rewrite or flat_file - which is more efficient?

Post by pickle »

I'd lean toward .htaccess & MySQL - simply from the maintainability aspect.

As a side note, a navigation file doesn't sound like the ideal place to handle setting up properties for the page that have nothing to do with navigation.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply