You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Daniel Yaÿfffffffffff1ez <da...@yahoo.com> on 2007/09/25 19:13:21 UTC

[users@httpd] image folder outside the root....how to access it ?

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 !!!


       
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting 

---------------------------------------------------------------------
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: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] image folder outside the root....how to access it ?

Posted by Joshua Slive <jo...@slive.ca>.
On 9/25/07, Daniel Yaÿfffffffffff1ez <da...@yahoo.com> 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: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: image folder outside the root....how to access it ?

Posted by Michelle Konzack <li...@freenet.de>.
Am 2007-09-25 10:13:21, schrieb Daniel Yaÿfffffffffff1ez:
> 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. 

<IMG src="http://www.somedomain.tld/image.php?id=cdshcjcehzdjwdhwdw">

I use a PHP cgi to send ANY content outside the Document-Root.

Attention: Do not forget to send THE RIGHT content/type.

Also my "image.php" count the access per minute per IP.  So no one can
abuse my "image.php" to suck an entired Website of 28 TByte of documents
in light speed.

(No one will access more then 2-4 Documents per minute on my website and
then read it or such... even if my website can serv over 200 per minute)

Thanks, Greetings and nice Day
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSN LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Re: [users@httpd] Apache log files on Windows

Posted by Sander Temme <sc...@apache.org>.
On Sep 25, 2007, at 11:17 AM, James Sherwood wrote:

> We are using Apache 2.0.54 on a windows server 2003.  When I try to  
> copy the logs I get the error "A program has a partial lock on the  
> file"

This means you're trying to copy a file that's being written to, and  
the OS thinks it has a good reason not to let you do that.  Why are  
you trying to copy the live file?  It'll get you a bunch of stale  
data and next time you copy it won't be easy to determine the  
boundary of the stuff you have already copied.

Are you trying to rotate the logs?  The best way to do that is as  
follows:

1) Rename the old log file(s).  Apache will continue to write log  
data to
    the old files, since it has open file handles on them and the OS  
is not
    fooled by something so trivial as a filename
2) Send Apache a restart (or graceful restart) by calling

    c:\path\to\httpd -k restart

    (or -k graceful).  This causes Apache to open new, empty log  
files with
    the original names, closing the old open file handles.  New log  
entries
    will appear in the new log files without any loss.

S.

-- 
Sander Temme
sctemme@apache.org
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF




Re: [users@httpd] Apache log files on Windows

Posted by Norman Peelman <np...@cfl.rr.com>.
William A. Rowe, Jr. wrote:
> Mark A. Craig wrote:
>   
>> Should I "pipe up" at this juncture and mention the ongoing trouble with
>> using such utilities with Apache in Windows?
>>     
>
> No problems.  2.2.6 solves these issues.
>
> Bill
>
> ---------------------------------------------------------------------
> 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: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>   
Even with the issues, I believe Rotatelogs still 'works' under 2.0.54. I 
could be wrong as I just jumped ship to Linux and everything got 
upgraded in the process.

Norm


---------------------------------------------------------------------
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: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache log files on Windows

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Mark A. Craig wrote:
> Should I "pipe up" at this juncture and mention the ongoing trouble with
> using such utilities with Apache in Windows?

No problems.  2.2.6 solves these issues.

Bill

---------------------------------------------------------------------
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: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache log files on Windows

Posted by "Mark A. Craig" <ma...@gmail.com>.
Err, that was supposed to be humor, but I hit a wrong key and sent the message 
before I was done making it obvious. :-/

Mark

-------- Original Message  --------
Subject: Re: [users@httpd] Apache log files on Windows
From: Mark A. Craig <ma...@gmail.com>
To: users@httpd.apache.org
Date: Tuesday, September 25, 2007 05:45:58 PM

> Should I "pipe up" at this juncture and mention the ongoing trouble with 
> using such utilities with Apache in Windows?
> 
> -------- Original Message  --------
> Subject: Re: [users@httpd] Apache log files on Windows
> From: Norman Peelman <np...@cfl.rr.com>
> To: users@httpd.apache.org
> Date: Tuesday, September 25, 2007 03:58:48 PM
> 
>> James Sherwood wrote:
>>>
>>> Hello,
>>>
>>> I was wondering if anyone knows a way to copy a log file from apache 
>>> without shuting down apache on a windows server 2003?
>>>
>>> We are using Apache 2.0.54 on a windows server 2003.  When I try to 
>>> copy the logs I get the error "A program has a partial lock on the file"
>>>
>>> Thanks,
>>> --James
>>>
>>>
>> Rotatelogs.exe
>>
>> Do a search on apache.org
>>
>> Norm

---------------------------------------------------------------------
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: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache log files on Windows

Posted by "Mark A. Craig" <ma...@gmail.com>.
Should I "pipe up" at this juncture and mention the ongoing trouble with using 
such utilities with Apache in Windows?

-------- Original Message  --------
Subject: Re: [users@httpd] Apache log files on Windows
From: Norman Peelman <np...@cfl.rr.com>
To: users@httpd.apache.org
Date: Tuesday, September 25, 2007 03:58:48 PM

> James Sherwood wrote:
>>
>> Hello,
>>
>> I was wondering if anyone knows a way to copy a log file from apache 
>> without shuting down apache on a windows server 2003?
>>
>> We are using Apache 2.0.54 on a windows server 2003.  When I try to 
>> copy the logs I get the error "A program has a partial lock on the file"
>>
>> Thanks,
>> --James
>>
>> ---------------------------------------------------------------------
>> 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: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
> Rotatelogs.exe
> 
> Do a search on apache.org
> 
> Norm
> 
> ---------------------------------------------------------------------
> 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: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 

---------------------------------------------------------------------
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: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache log files on Windows

Posted by Norman Peelman <np...@cfl.rr.com>.
James Sherwood wrote:
>
> Hello,
>
> I was wondering if anyone knows a way to copy a log file from apache 
> without shuting down apache on a windows server 2003?
>
> We are using Apache 2.0.54 on a windows server 2003.  When I try to 
> copy the logs I get the error "A program has a partial lock on the file"
>
> Thanks,
> --James
>
> ---------------------------------------------------------------------
> 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: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
Rotatelogs.exe

Do a search on apache.org

Norm

---------------------------------------------------------------------
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: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Apache log files on Windows

Posted by James Sherwood <js...@rgisolutions.com>.
Hello,

I was wondering if anyone knows a way to copy a log file from apache without 
shuting down apache on a windows server 2003?

We are using Apache 2.0.54 on a windows server 2003.  When I try to copy the 
logs I get the error "A program has a partial lock on the file"

Thanks,
--James 


---------------------------------------------------------------------
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: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] image folder outside the root....how to access it ?

Posted by Jesse Ross <jr...@broad.mit.edu>.
Hi Daniel,

This is what the Alias directive is for:

http://httpd.apache.org/docs/2.2/mod/mod_alias.html#alias

Regards,
Jesse Ross


Daniel Yaÿfffffffffff1ez 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 !!!
> 
> 
>        
> ____________________________________________________________________________________
> Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
> http://smallbusiness.yahoo.com/webhosting 
> 
> ---------------------------------------------------------------------
> 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: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
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: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org