My Website URL is https://www example.com/index.do

My Mobile Website URL is https://m.example.com

What URL need to mention for Mobile site home page for canonical

<link rel="canonical" href="https://www.example.com/index.do">

or

<link rel="canonical" href="https://www.example.com/">

Well website home is run with this one https://www.example.com/index.do

  • Is the index.do portion necessary? Usually the index document is the "default" document and it will show up if you omit the document name and just end the URL in the slash. – Stephen Ostermiller Sep 14 at 10:41
  • currently its require so what to do in current scenario – Hitesh Sep 14 at 11:13

The solution here is to use both the rel="canonical" and rel="alternate" tags on your general website home page, and just the rel="canonical" tag on the mobile page.

Thus, on your regular home page:

<link rel="canonical" href="https://www example.com/index.do">
<link rel="alternate" media="media query for your mobile page" href="https://m.example.com">

On your mobile home page:

<link rel="canonical" href="https://www example.com/index.do">

Complete documentation here:

https://developers.google.com/search/mobile-sites/mobile-seo/separate-urls

As you said your desktop version of website is redirect to example.com/index.do when you just open the example.com URL.

So here you're doing 301 redirection, which means even if you setup other canonical link tag like https://www.example.com/, then it will be overwrite by 301 redirection, which means Google will index https://www.example.com/index.do in their search result pages, not your prefer canonical link tag.

So always set canonical link tag which is your destination URL or to redirect URL.

In case of mobile, you already doing 301 redirect to mobile version of site automatically, so you don't need to add alternate meta tag which is mention by Henry, but here if you're not doing 301 redirection and using other technique to do redirection then it will be major problem, that time you can use alternate meta tag.

To check how Google see your mobile site use fetch and render tool, and add your any desktop version URL for check and select Google Smartphone crawler and if it redirect to your mobile version then everything is fine.

In mobile site also don't forgot to use mobile version of canonical link tag.


I am not expert in HTTP rewrites rules, but by using that you can serve your index.do page directly in your homepage, and hence you can index your clean homepage URL in Google search result pages.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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