大网数据广告活动
网站运营与故障问答

Google indexed my home page with a completely wrong domain

· 52CE 我爱测

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 t…

问题原文

原帖链接 · 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:

  1. 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.

  2. 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2018-07-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。