问题原文
原帖链接 · Deepak Shrestha · CC BY-SA 4.0
I have searched but didn't find exactly like my situation, so need clues to understand this.
I have just hosted a site for client. Submitted sitemap on google search console. Rest of the URLs are indexed fine but Google indexed the homepage with completely wrong domain.
How can this happen and how to request Google to re-index my home page with correct URL?
社区高分解答
原帖链接 · Stephen Ostermiller · CC BY-SA 4.0
There are two ways this can happen:
Another domain name points to your server. Your server is doesn't have a specific rule for that domain and defaults to serving the content of your main site.
Somebody is copying your entire site, possibly through a reverse proxy.
In your case, it appears that the IP address for the two domains resolve to a similar IP address. Both IP addresses may be assigned to the same server.
You can change your server such that it doesn't blindly serve up your domain content for any old domain that points to it. Instead the default behavior could either be to redirect to your site, or to serve up an error page. Only requests for your domain name should show your content.
One way of doing so is with a rule in your .htaccess file that redirects any host name other than yours:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
It looks like you have already made such a change. When I put an HTTP request in for the other domain name or your IP addresses, I see "301 Permanent" redirect to your site. Google should pick up on those redirects within a couple weeks and you will be fine.
Another solution that can work is including canonical tags in all your pages. Then when Google finds pages at alternate addresses, Google knows what your preferred domain name should be. Google doesn't always honor canonical tags, but in a case like this it should do so eventually. Canonical tags can work for the reverse proxy cases where you don't have control of the server.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
