View Full Version : relative URL's?

01-19-2003, 06:22 PM
I have a navigation graphic on my website which I created in Fireworks. you click on it and get a popup menu. All was working fine whilst I was just using the root directory but now I have made the directory structure more complex, I have a problem.

For example the site may be showing a picture in www.brickhillsrotary/social/pictureone.html and the navigation button for ome points to index.html. The url therefore moves to www.brickhillsrotary/social/index.html when I really want to be in www.brickhillsrotary/index.html!

I think what I need to do is put something in the link so that it knows to start from the root directory. However when I changed it to /index.html it looked for a url of /index.html!

Thanks in advance for any help,


01-19-2003, 06:46 PM
Although your URLs aren't working the way you linked them in the post I think all your looking for is this: href="../index.html". The 2 dots will send them one directory up.

- Terry

01-19-2003, 06:49 PM
ok i think i understand what you are asking

if youve got a page on www.example.com/page.html and you want an image in www.example.com/folder/image.jpg you would referance that as folder/image.jpg

if youve got a page on www.example.com/folder1/page.html and youve got an image on www.example.com/image.jpg, you would use ../image.jpg

so putting the two together, if youve got a page on www.example.com/folder1/page.html and you want an image on www.example.com/folder2/image.jpg you would use ../folder2/image.jpg

if you had a very complex structure it can get abit tricky:

say you have a page in www.example.com/folder1/folder2/page.html and an image in www.example.com/folder3/folder4/folder5/image.jpg you would use ../../folder3/folder4/folder5/image.jpg...

does that help... or have i got a completely wrong idea? ;)

whoops... i type too slow

01-19-2003, 08:22 PM
Thanks you two. That has takenme slightly further forward. However, the graphic that drives the navigation is the same one on all the pages. Therefore where I want it to go to index.htm when I am in the root, I will want it to go ../index.htm when I ams in the social sub.

The image is part of a fireworks designed template so I ideally don't want to change it just on the pages where i drop into a subdirectory.

I was thinking that there must be some way of always providing the href from the root point as it were? If there isn't then maybe I just need to haev a completely flat directory structure for my pages and just use directories for my images (where it seems to work!)



01-22-2003, 12:14 AM
In that case, why not make it an absolute link, rather than relative?


That way, it will always link to the same place, regardless of the origin of the link.:)