I am trying to use a subdomain to make an internal file browser on my site look flashier. My site is example.com
. I have a directory at example.com/files/
, with many various subdirectories.
I want files.example.com
to point internally to example.com/filebrowser/index.php?uri="files"
, which will print all the files and subdirectories in example.com/files/
.
The file browser currently uses $_SERVER['DOCUMENT_ROOT']
(/examplehost/1234/
) to construct the address of the directory to search and index, however when accessed via files.example.com
, the root address includes /examplehost/1234/filebrowser/
, causing a failure to find the directory.
How should this issue be solved without hardcoding a document root?
/examplehost/1234/filebrowser/
? For instance with dirname(), like so: 3v4l.org/Y1RUr