As far as I am aware there are two different ways of 'routing' and using 'friendly urls'
1: Solely using .htaccess:
RewriteRule ^foobar/([^/]+)/([^/]+)$ "index.php?foo=$1&bar=$2" [NC]
or 2: Using .htaccess in conjunction with an index.php 'routing' system:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# if file not exists
RewriteCond %{REQUEST_FILENAME} !-f
# if dir not exists
RewriteCond %{REQUEST_FILENAME} !-d
# avoid 404s of missing assets in our script
RewriteCond %{REQUEST_URI} !^.*\.(jpe?g|png|gif|css|js)$ [NC]
RewriteRule .* index.php [QSA,L]
</IfModule>
And then inside index.php:
$uri = explode("/",substr($_SERVER['REQUEST_URI'],1));
if((isset($uri[0])) && ($uri[0]!="")) {
$page = $uri[0];
if(is_file(ROOT."/subs/docs/$page/config.php")) {
include(ROOT."/subs/docs/$page/config.php");
}
} else {
$page="home";
}
then include $page somewhere down the line.
My question is, which way is better, or is there some other method I am unaware of? And by better I mean in terms of efficiency, speed, and logic.