view raw
Oliver Angelil Oliver Angelil - 9 months ago 34
HTML Question

Password protect automatically generated .html files

I'm using the code in Tom's response here. However I have a script that automatically generates .html files into my public_html folder. These files are then loaded by my .php file, which looks something like this:


However the "secret_information.html" file is viewable by anyone without the password. I am running an Apache web server. As I understand, all html code / images to be used on a website need to be in the public_html folder. So how can I hide this information? Do I need to setup my automated scripts to generate .php files rather than .html or is there another solution?


include can access any file, as long as it is accessible by the web server.

So you can put secret_information.html anywhere in the file system, preferably outside of the document root or public_html.

If you must keep the file inside your publicly accessible web for some reason, you may use Apache's Authentication and Authorization facility.