Yesterday at work I wanted to check the correct syntax of an URL (our class there is called URI). So I first checked Wikipedia for a basic approach (don’t tell me, I know its not reliable!). There it said that an URL is an URI. But an URI doesn’t have to be an URL, it can be an URN (ah, you know what it stands for?) as well.

That was new to me, I was never sure what the real difference is but I was sure there is one (between an URI and an URL). So, I was wrong. Thats bad enough but as it seems nearly all of the people I know are wrong as well or don’t know at all.

So always remember, URL is a subset of URI.

And an URN is something you never want to know (I didn’t read more about it as it sounded pretty boring). If I am wrong then tell me! 😉

Syntax of an URL

So then I checked the correct syntax of the URL, and I was partly wrong with that as well. What a bad day.

There is a difference between absolute and relative URL. And don’t mix that up (as I did)! All of these paths/links/URLs are relative:




Yeah, I thought the last one is an absolute one. Well, maybe it is in another context. Not in this one (I hope I got it right this time ;-)).

Ok, so what is an absolute URL? Here we go:



And now comes one relative URL that is the reason why I had to check this all:


Yeah, guess what, you can write that in your own Website and it is a valid link to the post on my blog here. Its a relative URL as it is using the “original” protocol scheme (hopefully “http://” in this case). Thats exactly the point where I did it wrong (and PHPs useless parse_url as well).

Another thing I found out is that this URL is not only valid but also has parameters for each path segment:


So the stuff between the semicolon and the slash is not part of the path but a parameter for that path segment. Some JSP pages/server/whatever use that to append the Session-ID string to the URL, but completely at the end like this:


Now this is not a querystring, it is a path segment. Strangely.

Ok, enough for today, for me it was quite frustrating as these are somehow the basics and I didn’t know it. But I think I am not completely alone in the dark…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s