On 9/25/07, Daniel Yaÿfffffffffff1ez <[EMAIL PROTECTED]> wrote:
> Hello everyone, I have been trying to make this work but so far I havent been 
> able to successfully load an image (or other media file) that is in a folder 
> outside the root of my domain. I initially wanted to do this in order to be 
> able to deliver this images from code running inside my serer, but to prevent 
> people from linking directly to the image (or file) using the address bar 
> (example: http://www.fakedomain.com/images/image1.jpg).
>
> I know it might be possible to achieve this using an .htaccess but I heard 
> they are a little bit unsecure plus the slow down the server. (in the apache 
> website they reccomend not using it).
>
> My problem is that whenever I try to link to an image outise the root it 
> simply will not work. For example lets say my fictional root folder is this 
> one: www/var/public_html/    and lets just say the index of my website then 
> is this:    www/var/public_html/index.html   now lets just say I want to put 
> my images in a folder located outside the root, like this:    
> www/images/image1.jpg etc. I should be able to link to the image like this 
> from my index.html file: ../images/image1.jpg but it doesnt work. Ive tried 
> several combinations but nothing seems to work.
>
> My question to you guys is if you know what apache setting needs to be turned 
> on (or off) to enable this? or how should I link to images outside the root.
>
> Thanks in advanced and I hope anyone here can help me because I have looked 
> in a lot of places with no success. Thanks again !!!
>

You've got a fundamental problem here: If the image file is not
accessible from the web, then it can't be embedded in an html page. In
order for the image to be displayed as part of the html page, the
browser makes a separate request for the image that, to the server,
looks identical to a request for the image alone (with the important
exception of the content of the Referer HTTP request header). Putting
the images outside the root is not, in itself, a problem. You can
simply use an Alias to map them into the webspace so they are
accessible from the web. But this will not help your direct linking
problem.

Here's my suggestion: 1. Check to see if you really have a direct
linking problem. Is this really causing you serious problems? Can you
fix it just by occasionally changing the name of your image file? 2.
If you decide you really need to prevent hotlinking/embedding of your
images in external pages, use one of the suggestions here:
http://wiki.apache.org/httpd/DisableImageHotLinking
Note that neither of these require the use of .htaccess.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to