I am trying to return the current directory of a file in php, regardless what it says in the browser bar. I have tried:
echo $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
If the url is
http://example.com/directory1/directory2/var1/var2/var3
the above code returns
example.com/directory1/directory2/var1/var2/var3
even though var1/var2/var3 are GET_[] variables tamed by a htaccess RewriteRule. Is there a decent way to get the directory? in the case above I would like to return:
example.com/directory1/directory2/
thanks.
How about replace it with
SCRIPT_FILENAME?