Storing/Accessing Files with Sensitive Data Outside of Web Root

Avatar
  • Answered
Is it possible to store a file, such as one containing database credentials outside of the web root. If so, how would I then access the file from a script located within the web root?
Avatar
Scott
Hello,

Thank you for your question on accessing files in the home directory from the public_html folder. You can do that simply by placing the ../ in front of the file path of the file you need. It means it will look up to the next directory. For example, if the file is 'password.txt' and need to be accessed from the home directory, then the path would be '../password.txt'.

This will not work from addon domains, however.

Kindest Regards,
Scott M