Is there any easy way to identify the file initially handling the request, ignoring get arguments and handling (at least basic) mappings like /
to /index.php
?
Ideally what I'm looking for is something like $_SERVER['REQUEST_URI']
, except it returns the same value regardless of the get arguments and that value is the file requested, not the URI, nor the currently executing file ($_SERVER['PHP_SELF']
). In other words, a $_SERVER['REQUESTED_FILE']
or something. I haven't seen anything like that. Does it exist, or do I need to write something manually?
Update Here are some example URLs paired with what I would like the result to be:
example.com/mypage.php : /mypage.php
example.com/ : /index.php
example.com/foo/?hello=world : /foo/index.php
And these return values are true even in included files. See my answer below before answering, I think I've found what I was looking for.