I'm trying to setup a subfolder so that text files in it can be read or written to by a script in the root, yet not viewable to the public if found by a browser.

Can any wise ones out there give me a bit of advice of how to configure the CHMOD on the Apache Linux server? Thanks!

    You would use chmod to set the permissions of the directory and its text files such that the text files are readable and writable by whatever user the script runs under.

    You would configure the webserver such that it does not serve whatever is in that directory. Alternatively, you can place the directory outside of the website's public HTML directory, i.e., instead of configuring the webserver, you work around the current configuration.

      If your subfolder is inside your web root, then it can be tricky to prevent apache from serving them up. If you chmod the files so apache can't read them, then apache cannot see them and therefore can never serve them to a visitor.

      Your best bet would be, as laserlight suggested, to move this subfolder OUT of the web root (the public_html directory) and rely on a php script to read these files from another location.

      If you absolutely must leave this subfolder in the web root, then you might be able to put a DENY directive in an apache configuration file or in a .htaccess file.

        Write a Reply...