File in directory above htdocs

ChasW
edited November -1 in Support Forums

I have a php login script which looks for users in a MySQL database. Everything works fine when I have the database connection script in htdocs, calling it with .\connect_db.php.

However, I want to put the database connection script in the folder above htdocs, to ensure better privacy, since it obviously has to contain my database password. I call the script with ..\connect_db.php, but now it fails.

This worked correctly on another web hosting site which I want to transfer from.

Thank you for your help.

Comments

  • ChasW
    edited November -1

    Do you mean add the snippet so .htaccess looks like this...?

    # Custom 404 Not Found Error Page
    ErrorDocument 404 https://profreehost.com/404/index.php
    <files connect_db.php>
    order allow,deny
    deny from all
    </files>