I still use this method today, and throughout all this time, it has done is purpose almost perfectly (presently it's live on tiberath.com and has been so for at least two iterations of the site). Once I manage to hash out the one problem left, it'll be perfect for what I want to achieve with it.
To re-demonstrate how it works, the htaccess rule I'm using is so:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Thanks to intensive google searching, mind you.
The PHP I'm using to parse all of the URI data into the exact method I use for GET and POST data is:
function fix_uri($nockey = false) {
$uri = preg_split('![/|?|&|$]!', urldecode($_SERVER['REQUEST_URI']));
$i = 97;
$new_uri = array();
foreach($uri as $key) {
if(substr_count($key, "=")) {
$key = explode("=", $key);
$new_uri[ckey($key[0])] = $nockey ? $key[1] : ckey($key[1]);
} else if($key) {
$new_uri[chr($i)] = $nockey ? $key : ckey($key);
$i++;
}
}
return $new_uri;
}
(By exact, I mean exactly that. All GET and POST data I use is done in the form of a=&b=&c=. Although that function takes into account if I want to break away from that method and assign an actual value (such as &id=) to use. But this side is really immaterial to my request.)
The problem is, however, if I want to use this same trick within a subdirectory, the rule will assume the non-existent URI within the directory should be redirected to the root index.php file and not the index.php file on top of the file tree.
For example, if /admin doesn't exist, the rule will be:
tibbius.com/index.php?a=admin
If /admin does exist, it'll be tibbius.com/admin which will then on it's own load tibbius.com/admin/index.php.
If I want to load a non-existent subdirectory from that file, what I'd like is:
tibbius.com/admin/index.php?a=subdirectory
What I actually get is:
tibbius.com/index.php?a=admin&b=subdirectory
If that makes any sense to anyone (I'm hoping it makes sense to the people this post targets).
I can make this all go away if I put that same snippet inside it's own .htaccess file within the /admin directory. And although that's fine in the short-term, at the end of the day, I don't want a .htaccess for every individual subdirectory I create. As forgetting to upload it or copy it around will just infuriate me, and there's that whole "put all of that stuff into the apache config file for that specific site" thing because "excessive .htaccess usage can slow down page load times" etc.
It is 2am, so I may not be as clear in my desire as I can be. If there's still confusion, I'll clarify what I'm doing with examples and better explanation tomorrow.
Thanks in advance.