Forum Moderators: open
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"> <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)
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.
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.
If they can see it on their screen they already have the files in their browser cache.
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.
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.
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.