Canonical means “standard” or “authoritative”, so a canonical URL for search engine marketing purposes is the URL you want people to see.

The google bot indexes your domain www.domain.com and domain.com. This could result in a penalty for duplicate content.

An easy way to protect your site is to redirect all pages to one standard , canonical , URL. You can do this by creating an .htaccess file in the root of your webserver with this text.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^codehomepage\.com$ [NC]
RewriteRule ^(.*)$ http://www.codehomepage.com/$1 [R=301,L]

The first line tells your apache server to enable mod_rewrite.

The second line “RewriteCond %{HTTP_HOST} ^codehomepage\.com$ [NC]” looks for people who wants to access http://codehomepage.com. The “[NC]” flag makes the test case-insensitive.

The third line “RewriteRule ^(.*)$ http://www.codehomepage.com/$1 [R=301,L]” redirects codehomepage.com to www.codehomepage.com with a 301 redirect.