Mobile site, redirect, Google search results

I’m developing a mobile version of the store’s website and I’ve encountered this problem.
There is a site.com site and its mobile version on another m.site.com domain (a physically exact copy of the site in a different directory with other html markup templates, respectively). Redirection from the main version to the mobile version is done in php. On the mobile version, just a link to the full one.
Now the actual problem is, when searching from a regular desktop browser, links to Google lead to the regular version (http://site.com/catalog/488). And when searching from a mobile phone using the same Google, they give links like http://m.site.com/catalog/488 (which is generally logical). So the task is this – to make it so that when searching from a smartphone, the results display exactly the link to the main site.
As an example, I can give such a request from an Android smartphone to Google. I enter in the search “baby clothes”
One of the site results “www.gymboree.com” is exactly how the link is displayed. Well, when you switch, there is a redirect to the mobile version.
At the same time, you can also switch to the regular version from a mobile phone. Those. the redirect was not made using the .htaccess definition of HTTP_USER_AGENT.
Now, in a nutshell, how can I make Google mobile results show a link to the main site and not to the mobile version?


Answer 1, authority 100%

Use robots.txt, it is recommended to use the “Host” directive with site mirrors.

Leave a reply

Please enter your comment!
Please enter your name here