Search code examples
phpapachesubdomaindocument-root

How to access the directories outside the subdomain folder


How do I access a folder outside my subdomain folder.

For example, my domain is localhost and I have a subdomain m.localhost. And their folders are:

Server Root:
    /cdn/
    /contents/
    /mobile/
    .htaccess

And the folder /mobile/ is the root directory of my m.localhost. From the m.localhost, how do I access the /contents/ directory and it's contents using PHP?

$_SERVER['DOCUMENT_ROOT'] only selects the subdomain directory root.


Solution

  • Try this.

    realpath(dirname(__FILE__).'/../../../contents/nav/quicklinks.txt');