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

(singke) #1
ptg16476052

698 LESSON 25: Search Engines and SEO


You can use a meta tag to request that specific pages not be indexed or follow any of the
links on them:
<meta name="robots" content="noindex, nofollow">
You can also use the rel="nofollow" attribute on your links. This tells search engines
not to follow this specific link from your pages. Some search engines will still follow the
links, but they will not afford them the same amount of authority your site might lend to
a link that doesn’t have that attribute.

Understanding Canonical Links
Creating duplicate content is not only a bad thing when it comes to search engines, it’s
also very easy to do accidentally (or on purpose, but without malice). For example, every
directory on your server probably has a default page called something like default.html.
That means that someone can visit both http://www.example.com/ and http://
http://www.example.com/default.html and get the same content. This can happen if you have a
secure server (https://) that serves the same content as the nonsecure server (http://) or a
subdomain like www that serves the same content as the site URL without the www sub-
domain (http://www.example.com/ and http://example.com/).
One of the ways that search engines deal with duplicate content is by allowing you to
define which page is the authoritative or “canonical” version of the page with the canoni-
cal link in the head of the document:
<link rel="canonical" href="http://www.example.com/">
The benefit of using this tag is that you can place it on a page and then not worry about
whether your server is creating duplicates like the subdomain or the default page. The
canonical URL is defined.

Redirecting Duplicate Content
Another tool you can use for dealing with duplicate content is to redirect the duplicate
content to the canonical page. If you use a 301 redirect, you are telling the web server
that not only has this page moved, but it has moved permanently. You can do a redirect
in many ways; check with your hosting provider for the best way to redirect on your site.
Some hosting providers even provide tools to make creating redirects easy.
The most common way to create a redirect is with the HTAccess tool. This is only avail-
able on Apache sites. To create an HTAccess redirect, open the file .htaccess (note the
period at the beginning of the filename) in the root directory of your web server and type
the following:
Options +FollowSymLInks
RewriteEngine on
Free download pdf