I'm using a RewriteRule in .htaccess to redirect anything that is not an existing file, to a "cms.php" file which dynamically handles any request (or outputs some error message if appropriate).
Here's what I do in .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /cms.php [L,QSA]
Works like a charm.
However, for development purposes, I want to host the same site on my local XAMPP system as well. On my actual live webserver, the cms.php is right in de document root folder, hence I can use /cms.php there. But on my local development machine, this site is in some subdir, i.e. /cms.php is not the right path.
I also tried "cms.php" (without the / in front of it) as well as "./cms.php" (hoping that "." would denote the current dir) but to no avail. Only when I explicitly specify /the/correct/subdir/cms.php in the RewriteRule, it works OK, but obviously this is only valid on the development machine and not on my live webserver.
Can I somehow use a smart path or mod_rewrite variable or something, so that .htaccess understands it needs to redirect to my cms.php file in the same dir as where .htaccess itself resides ?