Cleaning Up Canonical URLs With Redirects

What the heck is a canonical URL? I didn’t know what a canonical URL was at first either, so don’t worry if you don’t know.

Canonical essentially means “standard” or “authoritative”, so a canonical URL for search engine marketing purposes is the URL you want people to see. Depending on how your web site was programmed or how your tracking URLs are setup for marketing campaign, there may be more than one URL for a particular web page.

The problem most search engine marketers run into deals with domains. Sometimes if a domain is not setup properly, the domain URL ( and the www domain URL ( are considered individual web pages. Since both pages maybe indexed by Google – you could get hit for duplicate content and at the very least you would be splitting your link popularity.

The easiest way to protect your site is to redirect all forms of your domain to one “standard” URL – a canonical URL.

For example to force the use of instead of, I have these lines in my .htaccess file. (This is Apache specific, if you use IIS the lines should be the same using ISAPI filter)

RewriteEngine On
RewriteCond %{HTTP_HOST} ^$ [NC] RewriteRule ^(.*)$$1 [R=301,L]

The first line “RewriteEngine On” tells Apache to enable Mod_rewrite – the engine responsible for manipulating URLs.

The second line “RewriteCond %{HTTP_HOST} ^$ [NC]” looks for when people access The “[NC]” flag makes the test case-insensitive, so it catches URLs like

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

Recent Posts

Leave a Comment