Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this image link that works on remote server but doesn't work on local server.

 //Remote Server Works

        <img src="../behind_wwwroot/img_folder_fast/cars.jpg">

//Local Server doesn't work

    <img src="../behind_wwwroot/img_folder_fast/cars.jpg">

Local server dir tree


Apache Document root and Directory set to C:/wamp/www/my_server

Image files exist in C:/wamp/www/behind_wwwroot/img_folder_fast/cars.jpg

I want to put uploaded images behind www root for obvious reasons.

Anybody pls help

share|improve this question

migrated from Aug 1 '11 at 2:11

This question came from our site for professional and enthusiast programmers.

what are the permissions of 'behind_wwwroot' on the local machine? – DTest Jul 29 '11 at 19:57
what are the permissions on the file? 9 secs faster @DTest, nice. Linux command: ls -ltr behind_wwwroot behind_wwwroot/img_folder_fast behind_wwwroot/img_folder_fast/cars.jpg – Phill Pafford Jul 29 '11 at 19:57
The folder has Read/write/Execute permissions alright. – Frank Nwoko Jul 29 '11 at 20:22
up vote 1 down vote accepted

There must be something else going on.

The web browser with translate the relative URL into an absolute one and then request it. As such you cannot access files outside the www root.

A webpage on

<img src="../folder/file.jpg" />

Will translate to a request for:

More specifically. You cannot request a file outside of the www root. If however your web page was in a folder (e.g. then this could work.

What reasons do you have for having the images outside of the www root? If you think you can access them anyway what advantage does it have? If you MUST have them outside the www root you need to have the server redirect requests using either PHP or some .htaccess rules.

share|improve this answer
Ok. Thanks. This is so a hacker can not gain access and delete all user uploaded images. – Frank Nwoko Jul 30 '11 at 23:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.