Page 1 of 1

mod_rewrite or flat_file - which is more efficient?

Posted: Fri Oct 17, 2008 8:37 am
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?

Re: mod_rewrite or flat_file - which is more efficient?

Posted: Fri Oct 17, 2008 10:02 am
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.