how do i 'stream' a file from outside web directory


#1

i am going to be creating a site that needs all photos and documents to be hidden completely from search engines and spider bots.

I have been told in the past to have them stored outside the root directory, but was not told how i do this and the best method of getting them to the pages that need them when a password is used to access the page.

Just looking around again and see that i could ‘stream’ the files across to the page that will be viewed?
How would I do this with PHP?
my server is Apache

If there are any, can someone kindly provide some links to pages that discribe how this may be done.

thanks


#2

I am sure you have already tried, but I would try and use google or some like search engine to search on streaming.

Sorry I couldn’t be of more help, hopefully someone else with more experience with this can answer your question.


#3

I don’t believe that you can “STREAM” with PHP rather you would need to use some other technology for the actual streaming and use the PHP as the scripting around it.

That being said, you can hide your “Files” from Webcrawlers by utilizing the ROBOTS.TXT file. You can find more information about robots.txt files by googling it or you can check out this wiki http://en.wikipedia.org/wiki/Robots.txt

Also keeping files outside of your webroot directory means just that.

If your webroot is (for example) /var/www/htdocs you might consider keeping your files in /var/www/privatedocs and adjust the appropriate permissions on the folder. This way the Webserver can access the files (through the scripting) but someone can’t casually stumble onto the folder and gain access.


#4

Keep in mind that the ROBOTS.TXT file is an agreement amongst search engines, rather than a strict rule. I don’t know any engines that ignore the ROBOTS.TXT file, but it’s always good to keep this in mind.

As for ‘streaming’, unless you have (FTP) access to the actual filesystem on the remote server, you’ll only be able to get to the ‘server output’. In other words, you won’t be able to get to the source of files that are parsed by the server (such as .PHP files).