HTML and CSS Reference
In-Depth Information
As I mentioned in Lesson 1, URLs are
uniform resource locators
. In effect, URLs are
street addresses for bits of information on the Internet. Most of the time, you can avoid
trying to figure out which URL to put in your links by just navigating to the bit of infor-
mation you want with your browser, and then copying and pasting the long string of gob-
bledygook into your link. But understanding what a URL is all about and why it has to
be so long and complex is often useful. Also, when you put your own information up on
the Web, knowing something about URLs will be useful so that you can tell people
where your web page is.
In this section, you learn what the parts of a URL are, how you can use them to get to
information on the Web, and the kinds of URLs you can use (HTTP, FTP, Mailto, and
so on).
Parts of URLs
Most URLs contain (roughly) three parts: the protocol, the hostname, and the directory
or filename (see Figure 6.15).
FIGURE 6.15
URL parts.
Protocol
Directory and filename
Hostname
The
protocol
is the way in which the page is accessed; that is, the means of communica-
tion 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 protocol
won't work if that server isn't running
File Transfer Protocol (FTP)
server software.
6
The
hostname
is the address of the computer on which the information is stored, like
www.google.com,
ftp.apple.com, or
www.aol.com.
The same hostname can support more
than one protocol, as follows:
ftp://example.com

