Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

Kinds of URLs 113

6


The rel Attribute


One additional attribute that’s supported by the tag is the rel attribute, which is used
to describe the relationship between the linking document and the document that the user
is linking to. There’s a set of specific values that should be used with this attribute. The
most well known is the nofollow attribute, which indicates that search engines should
not factor that link into their ranking of the document that is linked. nofollow is intended
as a measure to fight search engine spam. You would use it like this:


Link to example site


There are a number of other values that can be used with rel as well. You can see a
full list of the accepted values at the Microformats website at the following URL: http://
microformats.org/wiki/existing-rel-values.


Kinds of URLs


Many kinds of URLs are defined by the Uniform Resource Locator specification. This
section describes some of the more popular URLs and some situations to look out for
when using them.


HTTP


HTTP URLs are by far the most common type of URLs because they point to other docu-
ments on the Web. HTTP is the protocol that World Wide Web servers use to communi-
cate with web browsers.


HTTP URLs follow this basic URL form:


http://www.example.com/home/foo/


If the URL ends in a slash, the last part of the URL is considered a directory name. The
file that you get using a URL of this type is the default file for that directory as defined
by the HTTP server, usually a file called index.html. If the web page you’re designing


If you make sure that your file and directory names are short and
use only alphanumeric characters, you won’t need to include spe-
cial characters in URLs. Special characters can be problematic
in a variety of ways. When you’re creating your own pages, you
should avoid using spaces in filenames as well as other non-
alphanumeric characters whenever possible. The two exceptions
are _ and -, which are the preferred separators between words in
URLs.

CAUTION
Free download pdf