Hongmu Notes
Home Summary of pitfalls Block unnecessary web crawlers from accessing your website by modifying the robots.txt file.
Summary of pitfalls

Block unnecessary web crawlers from accessing your website by modifying the robots.txt file.

Block unnecessary web crawlers from accessing your website by modifying the robots.txt file.

I've built a small website that gets randomly crawled by search engines every day.

So, I created a robots.txt file to block all those useless, ridiculous spiders.

This is the first step.

User-agent: DotBot
Disallow: /

User-agent: SemrushBot
Disallow: /

User-agent: SiteAuditBot
Disallow: /

User-agent: SemrushBot-BA
Disallow: /

User-agent: SemrushBot-SI
Disallow: /

User-agent: SemrushBot-SWA
Disallow: /

User-agent: SplitSignalBot
Disallow: /

User-agent: SemrushBot-OCOB
Disallow: /

User-agent: SemrushBot-FT
Disallow: /

User-agent: RyteBot
Disallow: /

User-agent: SemrushBot-ESI
Disallow: /

User-agent: MJ12bot
Disallow: /

User-agent: AhrefsBot
Disallow: /

User-agent: BLEXBot
Disallow: /

User-agent: TrendictionBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: Anthropic-ai
Disallow: /

User-agent: GPTBot
Disallow: /

User-agent: Amazonbot
Disallow: /

User-agent: PetalBot
Disallow: /

User-agent: *
Disallow: 
Crawl-delay: 10

Step 2: When the silly spider visits my website, it returns a direct 403 response.

Pseudo-static code – I'm using an Nginx environment.

# 屏蔽冷门爬虫(不遵守 robots.txt 或只采集不贡献流量的)
if ($http_user_agent ~* "(DotBot|SemrushBot|SiteAuditBot|SemrushBot-BA|SemrushBot-SI|SemrushBot-SWA|SplitSignalBot|SemrushBot-OCOB|SemrushBot-FT|RyteBot|SemrushBot-ESI|MJ12bot|AhrefsBot|BLEXBot|TrendictionBot|ClaudeBot|Anthropic-ai|GPTBot|Amazonbot|PetalBot)") {
    return 403;
}

 List Explanation

  • DotBotMoz's web crawler.

  • Semrush All-in-One Package: Includes the main crawler and various specialized clones for different tools (SemrushBotSiteAuditBotSemrushBot-BA   etc.), single-use full-seal.

  • MJ12botAhrefsBotBLEXBotTrendictionBotThese are renowned international SEO/data analysis crawlers that solely collect data without driving any traffic.

  • ClaudeBotAnthropic-aiGPTBotUsing AI-powered web crawlers – if your server load was previously at 100%, it could be because they were running a massive crawling campaign.

  • AmazonbotPetalBotOther commercial web crawlers are equally useless.

Why use 403 instead of 502?

  • 403 ForbiddenA clear "Deny Access" signal will inform the web crawler that access is prohibited; as a result, it will typically stop crawling.

  • 502 Bad GatewayThis indicates a gateway error, which may lead the crawler to misinterpret it as a temporary server outage; as a result, the crawler may repeatedly retry the request, thereby increasing the system load.

微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

Browser caching increases the speed of secondary visits to your website

Browser caching increases the speed of secondary visits to your website Summary of pitfalls

Use browser caching of official words: If users will visit your website multiple times, browser caching of static resources can save users time. Cache headers should be applied to all cacheable static resources, not just to a small subset of static resources (for example, images). Cacheable resources include JS and CSS files, image files, and other binary object files (media files, PDF files, etc.). Normally, HTML doesn’t…
👁 202

Recommended reading

Beauty, Hairdressing & Makeup Styling Website Templates – 1049

Beauty, Hairdressing & Makeup Styling Website Templates – 1049 Practical Collection Yiyou template

An eYou CMS website template designed for the beauty, hairdressing, and makeup styling industry. Its fashionable and sophisticated design is perfect for showcasing beauty and hairdressing services, makeup styling offerings, current trends, and brand stories. This template helps beauty and hairdressing businesses attract customers online and enhance their brand image. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for eYou CMS...
👁 30
(Adaptive Mobile Version) Responsive Supply Chain Website – PBootCMS Template; Source Code for Import/Export Service Companies' Websites – 0477

(Adaptive Mobile Version) Responsive Supply Chain Website – PBootCMS Template; Source Code for Import/Export Service Companies' Websites – 0477 Practical Collection pbootcms Template

This set includes an adaptive mobile-friendly brown furniture decoration and building materials PbootCMS responsive website template. The design features a warm, wooden aesthetic, making it ideal for showcasing furniture products, interior design projects, or building materials trade opportunities. It helps furniture and building materials enterprises showcase their brands online and attract both renovation companies and consumers. Template Preview | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn...
👁 46
(Adaptive Mobile Version) Navigation Website Template – Website Directory Source Code Download – 1042

(Adaptive Mobile Version) Navigation Website Template – Website Directory Source Code Download – 1042 Practical Collection pbootcms Template

A navigation website and website directory PbootCMS template, compatible with both PC and WAP devices. The clear, categorized design makes it ideal for website directory indexing and URL navigation services. It helps website operators organize online resources, attract users to visit the site, and encourage them to submit new entries for indexing. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn | Related Articles...
👁 52
Responsive Fruit Tree Landscape Potted Plant Website Template 0450

Responsive Fruit Tree Landscape Potted Plant Website Template 0450 Practical Collection Yiyou template

This EyouCMS responsive template is ideal for the fruit tree landscaping and potted plant industry. Its natural and artistic design style is perfect for showcasing fruit tree products, garden landscapes, potted plant designs, and brand stories. It helps landscaping and gardening businesses showcase their projects online and attract customers. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS...
👁 32
Medical and Pharmaceutical Company Website Template 1050

Medical and Pharmaceutical Company Website Template 1050 Practical Collection Yiyou template

This EYO CMS template is ideal for healthcare and pharmaceutical enterprises. Its professional and clean design effectively showcases pharmaceutical products, manufacturing technologies, R&D capabilities, and corporate image. It helps pharmaceutical companies present their brand online and attract hospitals as well as distributor clients. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EYO CMS | EYO CMS (Eyo...
👁 39
(With mobile version) Green eco-agricultural enterprise website PBootCMS template – Agricultural planting website source code download – 0478

(With mobile version) Green eco-agricultural enterprise website PBootCMS template – Agricultural planting website source code download – 0478 Practical Collection pbootcms Template

A PbootCMS website template designed for the exhibition and stage equipment rental industry, compatible with both PC and WAP mobile devices. Its sophisticated, modern design effectively showcases the professionalism and scale of trade shows and events. The template includes built-in modules such as exhibition scheduling, equipment displays, and case study collections, making it an excellent choice for exhibition organizers or equipment rental providers looking to acquire new customers and promote their brand. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password...
👁 50