HTML and CSS Reference
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. This issue is covered in Lesson 19, “Designing
for the Real World.”
If a port number is necessary, it's placed after the hostname but before the directory, as
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 a link to
Finally, the directory is the location of the file or other form of information on the host.
The directory does not necessarily point to a physical directory and file on the server.
Some web applications generate content dynamically and just use the directory informa-
tion as an identifier. For the files you work with while learning HTML, the directory
information will point to files that exist on your computer.
Special Characters in URLs
A special character in a URL is anything that is not an upper- or lowercase letter, a num-
ber (0-9), or one of the following symbols: dollar sign ( $ ), dash ( - ), underscore ( _ ), or
period ( . ). You might need to specify any other characters by using special URL escape
codes to keep them from being interpreted as parts of the URL itself.
URL escape codes are indicated by a percent sign ( % ) and a two-character hexadecimal
symbol from the ISO-Latin-1 character set (a superset of standard ASCII). For example,
%20 is a space, %3f is a question mark, and %2f is a slash. (Spaces are also sometimes
encoded as + signs, and + signs are encoded as %2b .)
Suppose that you have a directory named All My Files . Your first pass at a URL with
this name in it might look like the following:
If you put this URL in quotation marks in a link tag, it might work (but only if you put it
in quotation marks). Because the spaces are considered special characters to the URL,