5

I am a little bit confused regarding the usage of canonical tags and base tags.

I have placed canonical tag (rel="canonical") on my website because of my website opening with no-www. I have reviewed my website through SEO doctor add-ons which is showing that my website is not indexable in search engine. Can anyone can explain this?

2 Answers 2

5

Canonical Tag

The canonical tag tells search engines what the URL of the current page should be.

<link rel="canonical" href="http://www.example.com/mypage.html" />

tells search engines that the current page should be indexed at http://www.example.com/mypage.html even if they crawl it at http://example.com/mypage.html

Base Tag

The base tag tells all browsers how the URLs of every relative link in the page should start.

<base href="http://www.example.com/">

tells browsers (and crawlers) to open any relative links in such a way that they start with http://www.example.com/. So a link to /myotherpage.html would go to http://www.example.com/myotherpage.html, even if that link were found on http://example.com/mypage.html


Without examining your website itself, I can't tell you why your site isn't able to be indexed. If you add a comment with a link to it, we can take a look at it. Using canonical tags and base tags should not prevent your site from being indexed if you used them correctly.

1

rel="canonical" solution is frequently used between two pages with same content (not for an entire website). Explanations here.

Base tag is different and used to specify default URL for all relative URLs in the page.

However, keep available two versions of your website (www and no-www versions) can be hasardous because it generates duplicate content. And Google doesn't like duplicate content, that's why it's good seo pratice to redirect www to no-www or the opposite.

If you use Apache HTTP Server as web server, you can create .htaccess file in root of your domain (if it doesn't already exist) and add these lines to redirect (301 redirect) www to no-www:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com [NC]
RewriteRule (.*) http://example.com/$1 [QSA,R=301,L]
</IfModule>

Of course, you replace example.com by your website URL.

You also can choose the opposite (redirect from no-www to www) if you prefer. No matter for seo if you choose one or other solution.

What is important is to implement 301 redirect solution unlike rel="canonical" solution to do this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.