MACMAN
MACMAN

Reputation: 1971

Web Folder Structure

I am working on a code where all the images are referred with a preceding "/"

eg:

<img alt="" class="repositioned" src="/images/top-b-strip.jpg" />

I have a wamp server where I run the code and find that image is not coming correctly until I remove the prceeding "/" before images.

 <img alt="" class="repositioned" src="images/top-b-strip.jpg" />

Can anybody explain anything I am missing here?

Upvotes: 0

Views: 1561

Answers (2)

J. Steen
J. Steen

Reputation: 15578

Putting a "/" at the start of your path denotes that it's absolutely situated at the root of your server. For instance, http://www.example.com/images/top-b-strip.jpg, where as you may actually have them as http://www.example.com/somesubaccount/images/top-b-strip.jpg.

You can read more about absolute versus relative paths at, for instance, http://www.communitymx.com/content/article.cfm?cid=230ad

Upvotes: 2

ascanio
ascanio

Reputation: 1526

/images/top-b-strip.jpg is an absolute path, where you need to use a relative path (without the first /).

This means that images is actually a subdirectory of the directory where your html file is, while if you use the absolute path, the images folder is supposed to be a subfolder of the root directory of the file system.

Upvotes: 0

Related Questions