Forum Moderators: coopster

Message Too Old, No Replies

Content "outside" public html folder

         

nickknowledge

4:06 pm on Apr 18, 2005 (gmt 0)

10+ Year Member



In reading posts on keeping my content secure, I've implemented a solution of including content from a separate directory (e.g. www.mysite.com/content/Math/rectangle.inc)

My PHP script includes this content.

I've set my .htaccess up to not display the contents of the folder, but have seen recommendations on keeping the content out of the public_html folder altogether.

Where should I place it? Looking at the structure through my FTP program, I see that in the root directory, there is mysite.com - should I place the content folder there, and access it through relative naming, or do I use something like $_SERVER['DOCUMENT_ROOT']?

Thanks, Nick.

ironik

2:44 am on Apr 19, 2005 (gmt 0)

10+ Year Member



That would be the correct place to put it, since your www files are in mysite.com you can use a relative path to access the folder (or if you are able to, use an absolute system path).

If you wanted php files in your www folder but don't want other people to access them you can deny *.inc files or specify them to be handled by the PHP parser (which means that the public can no longer access them as plain text files, which reveal your source). If you're not .htaccess savvy you could just pop a .php extension on the end of the file.

nickknowledge

3:41 pm on Apr 20, 2005 (gmt 0)

10+ Year Member



Thanks for your help.

addhandler application/x-httpd-php .inc

works nicely for now, although I'll probably move the files out of the www folder altogether.