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

Shall I submit sitemap containing all the bad (now 404) URLs after the spam URL hack?

· 52CE 我爱测

Earlier this month, one of my sites got hacked and an attacker created near 1 million spam URLs. The site has been fixed relatively fast, however, after one month Google search results still shows near 500,000 results (number of …

问题原文

原帖链接 · RhymeGuy · CC BY-SA 4.0

Earlier this month, one of my sites got hacked and an attacker created near 1 million spam URLs. The site has been fixed relatively fast, however, after one month Google search results still shows near 500,000 results (number of real pages is ~100).

My site has slowly backed up in rankings but I want to speed things a little. Since I have a list of all the bad URLs, I thought of creating a sitemap with it and submitting it to the Google Search Console. Google will look for them, will see that they are now 404 error pages and hopefully they will get removed from the index.

I saw that some people did this tactic with 100-1000 URLs, but will submitting near 1 million 404 URLs actually hurt my site even more than the actual hack? Shall I leave it as is and hope for the best?

社区高分解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

You can submit a temporary sitemap with all the hacked URLs to Google as a method for getting Googlebot to come crawl all of them quickly. When you submit a sitemap of URLs, it will trigger Googlebot to crawl the URLs with greater priority.

You want Googlebot to come crawl the URLs so that it sees that they are "404 Not Found." If you don't submit a sitemap with these URLs, it could take Googlebot months to get around to crawling all of the URLs.

Since you have more than 50,000 URLs, you would actually need to submit multiple sitemaps each containing 50,000 URLs. 50,000 is the most URLs allowed in a sitemap. I would not recommend creating a sitemap index file because Google Search Console has had problems with them for the last few years. It typically doesn't show how many URLs it has found in them and it isn't clear that they work properly.

Once Google has seen a sitemap and crawled the URLs in it, you should remove it. I would expect that you should leave each sitemap up for at most a few months.

Reference: Use 404s & Temporary Sitemaps To Speed Up Page Removal From Google Search which quotes Google's John Mueller:

One way to speed this up could be to submit a temporary sitemap file listing these URLs with the last modification date (eg, when you changed them to 404 or added a noindex), so that we know to recrawl & reprocess them. This is something you'd just want to do for a limited time (maybe a few months), and then remove, so that you don't end up in the long run with a sitemap file that's not needed by your site

Submitting a sitemap with tons of 404 errors from hacked URLs won't hurt your site. Again quoting John Mueller

404 errors on invalid URLs do not harm your site’s indexing or ranking in any way. It doesn’t matter if there are 100 or 10 million, they won’t harm your site’s ranking. https://developers.google.com/search/blog/2011/05/do-404s-hurt-my-site

I wouldn't try this technique with other search engines like Bing, Yandex and Baidu. They haven't said that this would be appropriate and I haven't seen any indication that it would work with them.

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

资料来源与适用范围

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

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

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