views:

38

answers:

1

Using apache 2, I have a simple virtual host container:

<VirtualHost 127.0.0.1>
  ServerName developmentServer
  DocumentRoot /var/www
</VirtualHost>

The site is accessible, but I'm having trouble using root relative links within the site. I have an 'images' folder that is located at the root level. When I am within a folder or subfolder, I want to specify an image path that is root relative. (And actually all paths will be root relative regardless of the page depth.) This currently is not working:

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

But this will:

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

I understand the difference, but I do not know what needs to be changed in Apache to allow me start all links with a "/" so they are root-relative. I'm thinking there is a configuration setting, and I shouldn't have to rely on mod_rewrite. Any suggestions?

+1  A: 

Is the image located at /var/www/images/file.jpg and are you accessing the page containing this image over HTTP (http://developmentServer/...)? Then it must work.

Messa