When and where should the canonical tag to be used

If say i have a file linked in code as <a href="xyz.php"> Xyz</a>

Now do i have to write canonical tag as www.abc.com/xyz

@rickrocky33 See if it helps.

Sorry, but I don’t understand from your question what it is you are trying to achieve.

Google gives detailed instructions for canonical links, so this should answer your question:

when is do seo audit online.

it says that 2 url are found

  1. xyz.com
    so do immediate 301 redirect.

so how to do 301 redirect in .htaccess

any code that you can help me.

Is This right

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^/?$ “http://example.com/” [R=301,L]

which 1 of the following should be

if authour of the domain excuse
am providing the domain name

britishindiancurryhut.sg to

1 Like

Hi @rickrocky33, to rewrite www.domain.com to domain.com

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule .? http://domain.com%{REQUEST_URI} [R=301,L]

To rewrite domain.com to www.domain.com

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteRule .? http://www.domain.com%{REQUEST_URI} [R=301,L]

It doesn’t matter whether you choose the www. version or the non-www. version of the domain. That’s just a case of personal preference. You should also indicate your preferred domain in Google Search Console.

Hi @Gandalf.

Do i have to insert my domain name.

or just follow the rule.


Google search console . have to copy paste the html code is it.

That what you are saying right, if am not wrong.


@Gandalf thanks

1 Like

No - nothing to do with HTML.

Log in to Search Console, and use the “gear” icon in the top right-hand corner to open the menu.

Choose “site settings” from that menu.

That will take you to a page where you can set your preferred version. (To do this, you must have verified both the www. version and the non-www. version of your site.)


Thanks for your info. I have already did it.

1 Like

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