Skip to content
FunnelGuard

Fix guide by FunnelsGuard

robots.txt returns 404 or HTML: how to find and fix it

SEO-005Low impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

robots.txt is a small text file at the root of your site. It tells search and AI crawlers which URLs they may fetch. Crawlers request it before they crawl anything else.

This issue has two forms. In the first, the file is missing and the server returns a 404 status. In the second, the server returns HTML instead of text. This happens when a catch-all rule, a single-page app or a CMS router sends /robots.txt to your homepage or a custom error page, often with a 200 status (a soft 404).

Why it costs you leads or sales

The direct cost is small, but it adds up in indirect ways:

What you lose without a valid robots.txt
  • No way to keep crawlers out of cart, checkout, account, internal search and thank-you pages, so crawl time is spent on URLs that never earn leads.
  • No Sitemap: line, so crawlers find your money pages more slowly.
  • Rules you thought were live are not applied, for example blocks for staging paths or filter URLs.
  • An HTML page returned as robots.txt can contain stray text that crawlers parse as odd or unsupported directives.
  • Search Console reports and audit tools show errors that hide real problems.
How a bad robots.txt affects crawling
  1. Crawler requests /robots.txtFirst request on every crawl
  2. Server returns 404 or HTMLNo valid text file served
  3. Your rules are not readBlocks and Sitemap line ignored
  4. Crawl budget spent on low-value URLsCart, filters, search pages

The break is at the first request a crawler makes to your site.

How to check if your site has it

Open https://yourdomain.com/robots.txt in a browser. You should see plain lines such as User-agent: *. If you see your homepage, a styled error page or a blank page, the file is not being served properly. Then confirm with the status and content type.

Check status code and content typebash
curl -sI https://yourdomain.com/robots.txt | head -n 10

# Good: HTTP/2 200 and content-type: text/plain
# Bad:  HTTP/2 404, or content-type: text/html
What each response means
ResponseWhat crawlers doAction
200 + text/plainRead and follow the rulesNone
404Treat as no rules, crawl everythingCreate the file
200 + text/html (homepage or error page)Try to parse HTML as rules, results are unreliableServe real text and a correct route
5xxMay pause crawling (separate issue, SEO-004)Fix server error

Also check these places: the robots.txt report in Google Search Console (Settings > robots.txt), and test both the www and non-www versions, and http and https.

How to fix it

Start with a minimal, safe file. Then make your platform serve it as plain text.

Minimal safe robots.txttext
User-agent: *
Disallow:

Sitemap: https://yourdomain.com/sitemap.xml
Serve a valid robots.txt on your platform
  1. Remove a stuck physical file or rule

    If /robots.txt shows 404 or HTML, check the site root for an empty or wrong robots.txt file and your caching or security plugin for rules that rewrite it.

  2. Let WordPress or your SEO plugin generate it

    WordPress creates a virtual robots.txt when no physical file exists. SEO plugins such as Yoast SEO (Tools > File editor) and Rank Math (General Settings > Edit robots.txt) let you edit it.

  3. Check the permalink and server rules

    Go to Settings > Permalinks and click Save to refresh rewrite rules. On Nginx, make sure the try_files rule passes unknown paths to index.php.

Nginx: serve a real file as plain textnginx
location = /robots.txt {
    root /var/www/yourdomain;
    default_type text/plain;
    try_files /robots.txt =404;
}

How to confirm it's fixed

Confirm the fix
  1. Run curl again

    The response should be 200 with content-type: text/plain.

  2. Open the URL in a private window

    You should see plain text, not a page with your menu and footer. Try www, non-www and https.

  3. Check Search Console

    In Settings > robots.txt, open the report, find your host and check that the last fetch shows as fetched. You can request a recrawl there.

  4. Test a key URL

    Use the URL Inspection tool on a landing page and confirm it is not reported as blocked by robots.txt.

How to prevent it happening again

Prevention checklist
  • Keep robots.txt in version control or document where it is generated.
  • Re-check /robots.txt after every migration, theme change, CDN change or domain move.
  • Exclude /robots.txt from SPA fallback and redirect rules.
  • Do not let a plugin and a physical file compete for the same path.
  • Review the Search Console robots.txt report monthly.
  • Keep staging and live files separate so one is not copied over the other.

How FunnelGuard handles this

FunnelGuard does not check robots.txt yet. It is a possible future check. Today FunnelGuard runs your real customer journeys (lead forms, checkouts, booking and chat buttons) on a schedule from the EU or the US, and checks each step, the tracking hits sent to ad and analytics platforms, and whether test leads reach your inbox and CRM. That finds broken funnels, not crawler access problems.

To watch for this yourself, add a monthly reminder to run the curl command above, keep the Search Console robots.txt report on your review list, and use an SEO crawler or uptime tool that can check a URL for status code and content type. A free read-only website audit from FunnelGuard is also available, but it is not a robots.txt monitor.

Questions people ask

Why is my robots.txt returning a 404?

No file exists at the root of that host, or your platform is not generating one. On WordPress, a plugin, rewrite rule or caching layer may be blocking the virtual file. Create a plain text file in the web root, or enable your platform's built-in robots.txt.

Does a missing robots.txt hurt SEO?

Not directly. Google treats a 404 robots.txt as no restrictions and crawls the site normally. The cost is lost control: you cannot block low-value URLs or declare your sitemap in the file.

Why does my robots.txt show my homepage or an HTML page?

A catch-all rule is sending the request to your app or error page. This is common on single-page apps, CMS routers and sites with wildcard redirects. Add a real robots.txt file and exclude that path from the fallback.

What content type should robots.txt use?

It should be text/plain, ideally UTF-8, with an HTTP 200 status. Serving it as text/html can cause crawlers to read it wrongly.

How do I check my robots.txt is valid?

Run curl -sI https://yourdomain.com/robots.txt and check for 200 and text/plain. Then open the robots.txt report in Google Search Console to see when it was last fetched and whether any errors were found.

Do I need a robots.txt file at all?

It is optional, but recommended. It lets you keep crawlers away from cart, checkout, internal search and admin paths, and add a Sitemap: line. An empty or minimal file is better than a broken response.

Does FunnelGuard check my robots.txt?

No. FunnelGuard does not check robots.txt yet, though it is a possible future check. It monitors your funnels, tracking hits and lead delivery, so use curl or Search Console for robots.txt.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.