I was reading a post from Performancing in Bloglines today. However, I when I tried to click on a link within the post to another page on Performancing, I got a “404 page not found” error.
Why? Because they use root-relative URLs rather than absolute URLs for internal links on their site.
What’s a Root-Relative URL?
A root-relative URL is one that has all the usual path information in it, except for the site domain at the beginning – i.e. it starts at the root.
Here’s an example:
/miaow/archives/000216.html
However, in Bloglines this URL reads as:
http://www.bloglines.com/miaow/archives/000216.html
Hence, the 404 error.
It seems like this has been an issue for a while – back in 2003 Brainstorms & Raves wrote:
An exception where absolute URLs are required is within RSS feeds for which absolute URLs are currently still needed.
You’d have thought that this would have been fixed by now; apparently not. It may depend on which format you distribute your feed. I’d love to know more if anyone has additional information.
So, although the conventional wisdom is to use relative URLs for internal links within your site, bloggers may want to consider using absolute URLs to ensure that these links work in their RSS feeds.
I’m not 100% sure about this, but you might be able to get around this problem by using something like:
bc.
I know it works for regular (X)HTML web pages, but I’m not sure how it would be treated in an XML feed.
Either way, RSS feed readers should be designed to be smart enough to do this sort of thing automatically for relative URLs. They should know that any relative URL is relative to it’s original context and not whatever context the reader is displaying it in.
Whoops! I guess that live comment preview isn’t 100% accurate when dealing with HTML code… 😉
I’ve started using absolute URLs in all my posts for this reason.
Richard – fixed your code issue (when you put something in <code> tags you don’t need to worry about the left bracket being treated as HTML).
Interesting solution – wonder if it would work?! Like you said, though, feed readers should be able to understand this.
Ben – I do too, but only because when I copy and paste links I’m too lazy to strip out the domain part. Lucky for me, I guess!
So is this an issue with rss .92/2.0 only, or Atom as well?
Rob – sorry, I’ve no idea! It’s all a bit too technical for a simpleton like me. Try posting something on a forum like Sitepoint if you really want to know.
Just always use absolute Urls. That works.
Troy – that’s what I do. Keep it simple, I say!