Skip to content
Nazmul Nikhil
Menu

Robots.txt File Has Format Errors (Semrush): Fix the Syntax

Semrush found lines in your robots.txt that crawlers may misread or ignore. Here's the correct syntax, common mistakes, and how to test the file.

Nazmul Nikhil

By

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

Published 1 min read
Robots.txt File Has Format Errors (Semrush): Fix the Syntax
Photo: Chris J. Davis on Unsplash

In short

Semrush flags "Robots.txt file has format errors" when lines in the file don't follow the expected syntax. Crawlers skip rules they can't parse, so a typo can silently remove a block you relied on, or a misplaced rule can block important pages. Check each flagged line, use only standard directives, and test important URLs after the fix.

A small typo in robots.txt can block or unblock far more of your site than you intended.

Correct format

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Sitemap: https://example.com/sitemap.xml
  • One directive per line: field: value.

  • Each group starts with one or more User-agent lines.

  • Paths start with / and are case-sensitive.

  • Sitemap takes a full URL.

Common errors

Error Fix
Misspelled directive (Disalow, User agent) Correct the spelling
Rules before any User-agent line Put a User-agent line first
Relative sitemap URL Use the full https:// URL
File saved as HTML or with a byte-order mark Save as plain UTF-8 text
Unsupported directives (Noindex:) Remove; Google ignores them

Where to edit it

WordPress: Yoast (Tools > File editor) or Rank Math (General Settings > Edit robots.txt). Shopify: edit the robots.txt.liquid theme template. Webflow: Site settings > SEO > robots.txt. Wix: SEO dashboard > robots.txt editor. Custom builds: a static file at the site root.

Test with Search Console's robots.txt report after changes.

Common mistakes

  • Disallow: / left over from a staging site. It blocks everything.

This guide isn't affiliated with or endorsed by Semrush.

Sources and references

TAGSSemrush Site AuditSemrush robots.txt format errorsInvalid robots.txtRobots.txt syntax
Nazmul Nikhil

About the author

Nazmul Nikhil

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.

Need help with this?

Get it fixed with Technical SEO

I find the issues that cost you traffic and fix them, starting with the pages that matter most.

Keep reading

Related articles

All Site Audit Issues posts →

Get the next guide in your inbox

One email when a new SEO or AI search guide goes live.

Ready to grow?

Get a free audit of your website, or book a 30-minute call to talk through your goals.

Nazmul Hasan

Talk to Nazmul directly

Reply within 24h

WhatsApp +880 1682835118
nazmulnikhil@gmail.com