Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: relative URL's?

  1. #1
    New to the CF scene
    Join Date
    Nov 2002
    Location
    Milton Keynes
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    relative URL's?

    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,

    John

  • #2
    New Coder
    Join Date
    Sep 2002
    Location
    Moncton, N.B., Canada
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 http://www.example.com/folder3/folde...der5/image.jpg you would use ../../folder3/folder4/folder5/image.jpg...

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

    Edit: whoops... i type too slow
    Last edited by redhead; 01-19-2003 at 05:51 PM.
    redhead

  • #4
    New to the CF scene
    Join Date
    Nov 2002
    Location
    Milton Keynes
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Still stuck on relative urls

    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!)

    Cheers

    John

  • #5
    New Coder
    Join Date
    Jun 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In that case, why not make it an absolute link, rather than relative?

    i.e.
    http://www.brickhillsrotary/index.html
    not
    index.html

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •