Is it possible to make .htaccess "understand" dynamic relative paths and redirect to them properly?
My setup goes as follows:
http://domain.com/htroot/aaa/xyz
http://domain.com/htroot/bbb/xyz
http://domain.com/htroot/ccc/xyz
And so on. For the sake of the example, "htroot" contains the .htaccess I need to modify. The following sublevels (aaa, bbb, ccc) can be any a-z0-9 name, and the folders have an index.php (or any other .php to be redirected to). The xyz
should work as a parameter of sorts, see next part. The xyz
part is nowhere on the filesystem as a "physical" folder or file.
What I need to achieve is the following: When you access with the url
http://domain.com/htroot/aaa/xyz
it gets content from
http://domain.com/htroot/aaa/ (or http://domain.com/htroot/aaa/index.php, either way)
where the index.php kicks in -> I can get the xyz
parsed from REQUEST_URI and process it to serve the correct content that it specifies, while the URL of the page stays as http://domain.com/htroot/aaa/xyz
, naturally.
So far I have managed to pull this off if every sublevel (aaa etc.) has it's own .htaccess, but I would need one where there is only a single .htaccess located in htroot
that handles this. I'm guessing it might have something to do with the $0 parameters in .htaccess, but not sure.