Forum Moderators: open

Message Too Old, No Replies

relative links VS canonical links

does it really matter?

         

Reid

8:26 pm on Apr 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use relative links on my site:

1. every page has a

<base href="">
META tag. This prevents browsers from getting lost in the relative links.

2 relative link examples:
call file within same directory

<a href="file.htx">

call file from foo directory which is another folder in the root and you are calling it from a folder in the root directory
<a href="../foo/file.htx">

Example of canonical link:

<a href="http://w*w.mysite.com/foo/file.htx">

OK so I have heard some members speak against relative linking. As long as the base href tag is present on every page I don't understand what the problem is with it. Does it really matter?

The advantage I see to relative linking is
1. less code weight
2. not hard to change URL (just change all the base href's)
3. the page won't work if it is stripped from the site. (where canonical links will work from any domain)

BlobFisk

10:07 am on Apr 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Personally I always use relative links. There are arguements for an against, and some of the arguements for come from the SEO community.

To be honest, I have never seen any adverse effects, wither technically or from an SEO point of view, from using relative links. Indeed, as you point out, there are certain advantages.

Reid

10:42 am on Apr 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks for the reply blobfisk.

I don't know I hear some people mention 'always use full canonical links' but I can't imagine why it would matter either way.
Really I am fishing for opinions on both sides of the issue because I just don't get why it even is an issue.

Saltminer

1:24 pm on Apr 13, 2005 (gmt 0)

10+ Year Member



All I've ever used is relative links. I currently have 4 websites that use nothing but relative links, and I don't use any base href tags. Been doing it like that for years. I've never seen any errors in the log from a browser not being able to find a page, they handle the relative links just fine.

As far as SEO I haven't seen any difference either. Searches in Google will show every page with the full and correct URL, bots handle relative links just a well as browsers do. Rest assured they know what domain they are crawling and apply the links accordingly.

The advantage for me is that I can run the site locally from my harddrive for testing, or from a website CD (handed out at trade shows) and all the links work correctly since they are relative.

geekay

1:59 pm on Apr 13, 2005 (gmt 0)

10+ Year Member



I have seen here experienced webmasters recommend using always BOTH absolute links AND base href. I never understood that. The use of absolute links had something to do with the defence against 301 page hijacking.

I have been under the impression that the base href was about to be deprecated.

Saltminer

2:15 pm on Apr 13, 2005 (gmt 0)

10+ Year Member



The absolute links are supposedly to keep someone from stealing your pages as all the links point to your domain. But it would just be an inconvience, if they really want to steal some of your pages they can go in and edit the links easily enough. A "replace" command in a text editor would take care of that in a few minutes. A website has to be available to the public, there is really nothing you can do to prevent people from stealing scripts or images if they really want to do so.

If they can see it on their screen they already have the files in their browser cache.

geekay

5:52 pm on Apr 13, 2005 (gmt 0)

10+ Year Member



I meant 302 hijackings of course, not 301, in #5. Apologies if I've confused someone.

I agree with Saltminer. I pointed out that replace command in another thread - without success. But that was not about 302 hijacking. Perhaps absolute links can have some value in a hijacking defence. I don't know.

richlowe

6:30 pm on Apr 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use relative links most of the time. It saves bandwidth and makes the site easier to move and maintain. There is absolutely no reason of any kind to use absolute links within a site. The base ref tag is redundant and not needed. It is assumed to be the current root.

tedster

6:33 pm on Apr 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is one reason I know of - linking to my Home Page. I don't want www.example.com and www.example/com/index.html to be accumulating separate link pop, page rank, and so on.

Reid

7:26 pm on Apr 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I haven't had that problem / getting indexed seperately from /index.htm. I guess the user-agent is smart enough to know this also.

If i want to run my website on my home system it wont work unless I comment out the base href tags.

yes they are depecrated but still valid for HTML4.01 transitional.

I guess they are redundant and could be removed anytime, I just 'feel safer' with them there.

Reid

7:33 pm on Apr 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have seen here experienced webmasters recommend using always BOTH absolute links AND base href. I never understood that. The use of absolute links had something to do with the defence against 302 page hijacking.

That's why i started this thread.
I don't doubt that these guys know what they are talking about but I need to understand what I'm doing or at least why I am doing it before I run off and make global changes to my code.