Canonical URL and redirects

We just went through a redesign. I was trying to get my developer to set the canonical url to www for my domain.

My developer is saying is saying non-www to www is done through htaccess redirect .Not something that can be applied to the header code. Is this correct?

.htaccess is the normal way for doing this (if you are talking about redirecting non WWW to WWW (or the other way around).)

Canonicals refer to two pages that have the same content (or rather, pages you want to be treated as one.)

WWW vs non-WWW aren’t two separate pages to be treated as one. Search engines treat it as one already.

I’m confused. So based on what you said; and are treated as one already? If so, I guess I don’t need to do anything else. I was under the impression both pages are considered separate and in order to avoid duplicate content issues, I need to set the canonical to www or non-www

It would follow the www version (or non) as long as you specificy which one by default you want.

I mean technically it could be two…

Just set the htaccess to rewrite non-www to www. Super simple. That way you never have to worry about any of this.

Yes, you’re right. Google specifically says:

If you don’t specify a preferred domain, we may treat the www and non-www versions of the domain as separate references to separate pages.

You can set your preferred domain for Google through Webmaster Tools, but you should also set it in .htaccess, for other search engines and human visitors.


You can find (mod_rewrite) code for this in the examples at the bottom of the tutorial at



This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.