Have you ever gone to a website, noticed that the address bar is filled with a lot more stuff than simply http://www.example.com, and wondered what it all meant?  That is the topic of this article.

Terminology

The term web address does not have a technical definition. I will be using it throughout this post to refer to all the stuff in the browser address bar. If you’re interested in the proper definitions of URI, URL, and URN, I suggest this section of Wikipedia’s URI article.

A web browser, or simply browser, is the program that you use to visit websites.  Popular browsers include Internet Explorer, Firefox, Opera, Safari, and many others.

What’s Happening

The more interactive a website is, the more complex the web addresses can become, but the underlying principle is pretty simple. When you go to a website, your browser connects to another computer on the Internet and asks for a web page. All that stuff in the address bar is what you’re asking for, and who you’re asking.

Basic Components

In this section, i’ll use the following web address as an example.  Web addresses can have fewer components and they can have more, but this is a good starting point.

  http://www.example.com/animals/mammals?name=ferret#nose
  \__/   \_____________/\______________/\__________/ \__/
    |           |              |             |         |
scheme      authority         path         query   fragment

Scheme – This is the protocol that will be used. HTTP is the protocol used for websites. Usually your browser will assume you want to use HTTP, and will automatically prefix this to the web address you type.

Authority – This is the recipient of your request, generally the main website you want to visit.

Path – A website will often organize its pages in a kind of hierarchical structure.  You can think of it like folders, sub-folders and files, on your own computer.   If you look at the path for this article, you’ll see that it is arranged by year, month, day, and finally this article itself.  Sometimes the path will end in something like page.html for web pages, or song.mp3 for music files, but not always.

Query – The beginning of a query is marked by a question mark (?).  The query helps tell the server (the website you’re visiting), more about what you want.

Fragment – The fragment is marked by a number sign (#), and refers to a specific part of the web page.  the entire page will come up for you, but you’ll be automatically scrolled down to the specific section requested.

Putting It All Together

So in the example above, we are using http to talk to http://www.example.com.  We’re going to the animals area and further to the mammals area.  Next, we’re asking about something in the area named ferret.  And finally, we’re asking for the nose section of the page.

Further Reader

RFC3986 – The Official Standard

Wikipedia URI Article