$_SERVER['PHP_SELF']と$_SERVER['REQUEST_URI']と$_SERVER['SCRIPT_NAME']と
090219追記
この情報は古いっす。
↓
こっちに新しいの書きました。でも、結論出てない・・・。
| キー | URL | 値 | 
|---|---|---|
| PHP_SELF | http://hoge.com/example/ | /example/index.php | 
| http://hoge.com/example/index.php | /example/index.php | |
| http://hoge.com/example/index.php?a=test | /example/index.php | |
| http://hoge.com/example/index.php/dir/test | /dir/test | |
| REQUEST_URI | http://hoge.com/example/ | / | 
| http://hoge.com/example/index.php | /example/index.php | |
| http://hoge.com/example/index.php?a=test | /example/index.php?a=test | |
| http://hoge.com/example/index.php/dir/test | /example/index.php/dir/test | |
| SCRIPT_NAME | http://hoge.com/example/ | /example/index.php | 
| http://hoge.com/example/index.php | /example/index.php | |
| http://hoge.com/example/index.php?a=test | /example/index.php | |
| http://hoge.com/example/index.php/dir/test | /example/index.php | 
※パクリ元:http://php.about.com/od/learnphp/qt/_SERVER_PHP.htm