Jump to content

Recommended Posts

Posted

I was wondering a question about HTML.

When I have a HTML page in a directory say distance/distance.html and I want to relatively link from the distance.html page to say another page that is another folder or in a parent directory how do I do this?

As to what I'm wondering about precisly:

go to http://www3.pei.sympatico.ca/~sherrya/distance/united%20distance.html

at the very bottom is a link that says back to Sedermia main page.(which is supposed to be a link back to the main page that is not in any specific folder.) and it doesn't work.

It thinks that it is looking for main.html in the /distances directory when it should not be.

I do not want to absolutely link to any pages.

EDIT - I am just going to put all the HTML pages in one folder so I dont hvae this problem, but if anyone knows the answer please tell me, greatly appreciated.

Above link referring to my question is now going to be still there for now, although other pages will not be linking to it.

Posted

For starters, if you leave out the full directory, most browsers will assume you meant for it to look in the same directory. So, to eliminate this problem, you simply need to include the entire directory of the file name and insert that into the url. For example :link to http://www.geocities.com/username988/fanfic/poems.html, instead of linking to poems.html in the username998 directory (where the problem will arise).

Another method to do this is to setup a base URL. Here's how:

<base href="http://www.geocities.com/username988">

This sets that page's base url to what is in the double quotes, and whatever filename you enter, for example: index.html, will have the base url included, so the computer reads it as: http://www.geocities.com/username988/index.html. This eliminates the extra code and time spent on typing the base url over and over.

After looking at your website, it seems that there is no main.html in the distances folder; so to fix it either use the base url tag, and set it to: http://www3.pei.sympatico.ca/~sherrya/, or type it out: http://www3.pei.sympatico.ca/~sherrya/main.html.

Posted

The first part of your message looks like what I was referring to "absolute" linking (putting the whole web address)

But your second suggestion does work.

Thank you for your help. :)

Posted

No problem, but I'm curious - why the hate of absolute linking? Don't be a playa hata. ;)

Because I change ISP's every 6-9 months. And also put it up at different internet web sites. :D

Gob, I cant get what you want to work. I've tried several ways, but not sure what you mean. Do you mean in the <base href="/"> ?? or just in the link?

Posted

If I read Gob's post right, or if I didn't it doesn't matter because it's relevant enough, put a forward slash at the end of the url in the base tag, otherwise you'd have to put /index.html instead of index.html.

Posted

No problem, but I'm curious - why the hate of absolute linking? Don't be a playa hata. ;)

In some cases direct or absolute linking might not be that handy. If you are running a server from multiple IP's or domain names for one. Or frequently changing one of those.. .

Posted

It will depend on your username on those ISP's. If that is changing then it won't work. Links would be something like this:

<a href="/~sherrya/distance/united%20distance.html">link</a>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.