How To Identify The Requested Page In PHP
<p>Is there any easy way to identify the file initially requested by the user, ignoring get arguments and handling (at least basic) mappings like / to /index.php?</p>

<p>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?</p>

<p><strong>Update</strong>
Here are some example urls paired with what I would like the result to be:</p>

<pre><code>example.com/mypage.php       : /mypage.php
example.com/                 : /index.php
example.com/foo/?hello=world : /foo/index.php
</code></pre>

<p>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.</p>
