Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Banned
    Join Date
    Jan 2012
    Posts
    93
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Ways to prevent Apache from serving a folder?

    What are some ways to prevent Apache from serving a folder in the root directory?

    I have raw data in there containing PHP with passwords for my SQL database, and I don't want it being served up.

    I'm thinking just .htaccess with a password.

    Is it possible to do within my servers configuration file?

    I want to hear what other people would do.

  • #2
    Regular Coder
    Join Date
    Jan 2012
    Posts
    134
    Thanks
    0
    Thanked 32 Times in 32 Posts
    I wouldn't put any passwords in any web accessible directory, period. Move them outside your web root; php can still access those files where a random web user can't.

  • #3
    Regular Coder primefalcon's Avatar
    Join Date
    Aug 2008
    Location
    /home/primefalcon/
    Posts
    678
    Thanks
    8
    Thanked 39 Times in 39 Posts
    I agree with above post fully, but if you really want to use .htaccess you can create a .htaccess file in the folder you don't want entry past that contains the following only

    Code:
    deny from all


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •