How do web addresses work?

The key to accessing all this information is the URI - the Uniform Resource Identifier. Each web page has a unique address, specified by its URL, which tells the client/browser how to access the page. See the Wikipedia entry for URI.

Take, for example: http://student.cs.ucc.ie/cs1050/index.html

Example 2.1. The parts of a URL

http:

the method of “delivery” (ftp, file, etc.) Secure sites use https, an encrypted form on HTTP. The :// is important to distinguish this from the server name that follows

student.cs.ucc.ie:

the server computer the document is stored on. This could also be referred to by its “dotted-quad” IP number, e.g. 143.239.116.100. Breaking this down further:

student

the “hostname” — the name of the individual computer/server. These are usually decided upon by the organisation concerned, and can seem quite random!

cs

the “Department” - cs (Computer Science)

ucc

the Organisation - ucc (domain name = ucc.ie)

ie

the “country code” - uk, fr, de, etc. (there's no code for USA) - for more details see the Country Codes FAQ

cs1050:

the directory/folder

index.html:

the file itself


The slashes (/) are used to separate the parts of the address, in the same way as file locations use backslashes on your own PC. So, for example,

  C:\Documents and Settings\gbstring\My Documents\website\hello.html
                    

is equivalent to

  file:///c:/Documents%20and%20Settings/gbstring/My%20Documents/website/hello.html
                    

where %20 represents a space character. Note that spaces in filenames work well in Microsoft Windows, but don't work at all well with many webservers.

There're a couple of other features of this address that you may come across elsewhere on the web. The “hostname” here is student.cs.ucc.ie, but I've also set up an ALIAS which points the name cosmos to this server, so that we can use

    http://cosmos.ucc.ie/cs1050/index.html
                    

to refer to the same page. An alias is defined by your ISP in the DNS (Domain Name System) records, so has to be set up by them.

There's also a REDIRECT for the default page, i.e. if no page is given in the address, then the webserver will automatically add the /index.html file path to the page. Try typing

    http://cosmos.ucc.ie/
                    

and see what happens.