View Full Version : directory referencing

03-24-2009, 12:05 PM
remember 2 dots (..) move you up a level
Hi David,

You sound like you know what you’re talking about when it comes to issues of directory referencing. So, I’d like to bounce this off you:

I have been tasked to take over an existing site that is working just fine online. I’ll call it the “official” site. The previous developers were fired.

So, I used an FTP program to download the entire site and then tried to use that site as the basis for a new DreamWeaver project. I’ll call that new site the “test” site.

I have run into problems. Basically, the “official” site works just fine online now but when I tried to publish the identical site, as downloaded, from DreamWeaver I ran into serious problems:

1. The reference to a CSS main file, from an internal sub-directory, was wrong. So it would not preview correctly, nor did it display correctly on my “test” site.

The reason, as I discovered after reading your post, was that the internal referencing is wrong. Within a sub-directory of the root directory, the reference to the main CSS style sheet was: “/styles.css,” instead of “../styles.css,” as you recommended.

I changed all of the offending pages and the CSS worked just fine.

2. The reference to a main image directory, from an internal sub-directory, was also wrong. It was “/images.”

Again, following your advice to reference a directory above a current directory, I revised all sub-directory pages to use the convention “../images.”

After making these key changes, all of the files worked, as previewed in Dreamweaver and published to an FTP site.

The question, though, is why the current “official” site works just fine online even though these key linkages are incorrectly referenced?

Any ideas?


R. Y. Glover & Associates
1455 McTavish Road, North Saanich
British Columbia, Canada, V8L 5T3
Tel: 250-656-1227
Fax: 250-656-1227
Email: randalglover@shaw.ca
Web: http://www.rygloverandassociates.com

03-24-2009, 12:56 PM
This is a absolute path..


although its relative in repect of your www root and is interpreted as root/images

so no matter how deep you are in your directory structure by referencing this path you will reference root/images

this however is a relative path

this just looks for an images directory above the directory your looking in.

look at this structure

root / pages
root / images /
root / images / gifs
root / images / jpgs
root / images / pngs
root / scripts
root / CSS

if i wanted to ref a gif image from the jpgs directory i would write


[absolute] << but relative to your document root

[absolute] << true absolute

03-26-2009, 10:40 PM
Wow DJ - that's awesome. I knew what worked but never knew 'why'... cheers.

I tend to use true absolute for sites where the images folders are buried deep - eg wordpress:

03-26-2009, 11:31 PM
i think its best practice to use absolute but i was brought up on relative paths and cant shake the habit

03-27-2009, 03:08 PM
I heard some people say that absolute paths are bullet proof, so less risk.
I'm brought up on relative paths as well, and can't really shake em off either.