FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Directory/Script protection





imagefree
I want to protect a directory from being accessible by anyone on the net, so that all the html files cant be accessed by anyone other than my own php scripts executing on the same server.

For security i have two options, either placing all my files (that i want to keep away from hackers) outside of public_html directory, or make a dir out of the reach of the hackers, that will still be inside the public_html.

I want to ask you which of the ways is better?
Is it possible to make private a directory inside the public_html ? How?
If i place some files outside of public_html (that are just included in the main pages inside public_html), will the little chunks of php work that are placed in the files outside of the web dir?


Thanks
kv
I think keeping data outside public_html is better, but you could also have a dir under public_html and make it password protected. You can do it by placing a .htaccess (with appropriate entries) in the directory or using cpanel to do the same thing.
Stubru Freak
You can return a Forbidden status for every file in a directory using .htaccess. But if your .htaccess is gone for some reason, or if you change to a non-Apache server, your files are unprotected. So it's probably safer not to store them in public_html.
imagefree
kv wrote:
I think keeping data outside public_html is better, but you could also have a dir under public_html and make it password protected. You can do it by placing a .htaccess (with appropriate entries) in the directory or using cpanel to do the same thing.


Well in that case, will it be possible to access the password protected script using php include? How?
Stubru Freak
imagefree wrote:
kv wrote:
I think keeping data outside public_html is better, but you could also have a dir under public_html and make it password protected. You can do it by placing a .htaccess (with appropriate entries) in the directory or using cpanel to do the same thing.


Well in that case, will it be possible to access the password protected script using php include? How?


.htaccess only talks about access over http, not access by scripts. So you can include it the usual way.
AOP Web Development
i guess it will work on password protected directories.. but of course for those files you want to protect.
Or a forbidden... i guess it's on the cpanel or direct admin feature has.. but you can also play it on .htaccess
sonam
My important files are always out of public_html folder. It is quite simple to define file path and include it.

Sonam
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.