Difference between ../files and /files

upside

New Member
Hi,

I was wondering can somebody explain the difference between ../ and / in links? I thought for example ../files would go into a folder called "files" at the root level of your site and /files would go to a folder called "files" one step up from where the link is, but I seem to be getting varied results.

Many thanks,
greg
 

chrishirst

Well-Known Member
Staff member
You are correct, but you have them the wrong way around.

../files indicates that the 'files' folder is one folder ABOVE the document location.

eg: /include/files/document.ext

This is called document relative addressing

/files indicates that the 'files' folder is in the root of the site

eg: /files/document.ext

This is root relative addressing, using this syntax means that the location will be the same no matter WHERE the document is in the site structure (physical or virtual)

There are also two more possibles in document relative addressing;

./files/ and files/ which both indicate a subfolder of the current document location.

eg:
/../document.ext
/../files/
 
Last edited:
Top