Mobile app version of vmapp.org
Login or Join
Kristi941

: Difference between canonical and base tag 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

@Kristi941

Posted in: #CanonicalUrl #Indexing #NoWww #Redirects #Seo

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Kristi941

2 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

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 www.example.com/mypage.html even if they crawl it at 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 www.example.com/. So a link to /myotherpage.html would go to www.example.com/myotherpage.html, even if that link were found on 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.

10% popularity Vote Up Vote Down


 

@YK1175434

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 (.*) example.com/ [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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme