ptg16476052
Anatomy of a URL 111
6
http://daytona.raceway.com/home/www/files/race.html
Protocol Directory and filename
Hostname
The protocol is the way in which the page is accessed; that is, it’s the means of commu-
nication your browser uses to get the file. If the protocol in the URL is http, the browser
will attempt to use the Hypertext Transfer Protocol (HTTP) to talk to the server. For a
link to work, the host named in the link must be running a server that supports the proto-
col that’s specified. So if you use an ftp URL to connect to http://www.example.com, the link
won’t work if that server isn’t running File Transfer Protocol (FTP) server software.
The hostname is the address of the computer on which the information is stored, like
http://www.google.com, ftp.apple.com, or http://www.aol.com. The same hostname can support more
than one protocol, as follows:
http://example.com
ftp://example.com
It’s one machine that offers two different information services, and the browser will use
different methods of connecting to each. So long as both servers are installed and avail-
able on that system, you won’t have a problem.
The hostname part of the URL might include a port number. The port number tells your
browser to open a connection using the appropriate protocol on a specific network port.
The only time you’ll need a port number in a URL is if the server responding to the
request has been explicitly installed on that port. If the server is listening on the default
port, you can leave the port number out.
If a port number is necessary, it’s placed after the hostname but before the directory, as
follows:
http://my-public-access-unix.com:1550/pub/file
If the port is not included , the browser tries to connect to the default port number associ-
ated with the protocol in the URL. The default port for HTTP is 80, so links to http://
http://www.example.com:80/ and http://www.example.com/ are equivalent.
The path is the location of the file or other form of information on the host. The path
does not necessarily point to a physical directory and file on the server. Some web
applications generate content dynamically and just use the directory information as
FIGURE 6.14
URL parts.