On this page
What this issue is
A robots.txt file tells search crawlers which URLs they may fetch. It applies only to the exact protocol, host and port it is served from. So https://example.com/robots.txt does not govern https://www.example.com/, and the http:// version is a separate file again.
The problem appears when these versions differ. A common case: the main site has a clean file, but an old server, a CDN rule or a leftover staging config still serves Disallow: / on the other hostname. Another case: /robots.txt is not redirected the same way as normal pages, so each host answers with its own file.
Why it costs you leads or sales
Search engines may discover your pages through links, sitemaps or old URLs on any host. If the host they land on serves a blocking or outdated robots.txt, they treat those URLs as off limits. Pages can stop being crawled, new landing pages may not get picked up, and rankings can slip with no obvious error on your side.
It is also hard to spot. You open your site, the file looks fine, and nobody checks the other three hostnames. Impact is usually medium, but it can be severe if the blocking file sits on the host most of your backlinks point to.
- Link to www hostBacklink or old sitemap points to www
- Fetch www/robots.txtServes Disallow: / from old config
- Pages not crawledCrawler treats URLs as blocked
- Rankings and leadsFewer visits to landing pages
A crawler arrives on a host that serves a different, blocking file.
How to check if your site has it
Request the robots.txt from all four combinations and compare the status code, any redirect and the content. Replace example.com with your domain.
for h in http://example.com http://www.example.com https://example.com https://www.example.com; do
echo "== $h/robots.txt"
curl -sIL -A 'Mozilla/5.0' "$h/robots.txt" | grep -iE '^(HTTP|location|content-type)'
curl -sL "$h/robots.txt" | head -n 8
done| Result | Meaning | Action |
|---|---|---|
| 301 to your canonical host, then 200 text/plain | Healthy | None |
| 200 with different rules | Host serves its own file | Redirect or align the file |
| 200 with Disallow: / | Possible staging leftover | Fix urgently |
| 404, 5xx or HTML page | Missing or broken file | See the related robots.txt guides |
| Certificate error on https | Host not properly secured | Fix the certificate or redirect |
Also open Google Search Console. Add each host as a property (or use a Domain property) and check Settings > Crawl stats > robots.txt to see the file Google fetched and any errors for that host.
How to fix it
Choose one canonical host
Decide on https plus either www or non-www. Use the one already in your canonical tags and sitemap.
Redirect all other hosts with a 301
Redirect http to https and the non-canonical hostname to the canonical one, for every path including /robots.txt.
Fix the file on the canonical host
Make sure it holds only the rules you want and includes a Sitemap: line with the full https URL.
Remove stray copies
Check the server, CDN and any old hosting for extra robots.txt files or rules that answer on other hostnames.
Re-run the check
Run the curl loop again and confirm all four versions end on the same 200 response.
Set the site address
Under Settings > General, make WordPress Address and Site Address use your canonical https host.
Redirect at server level
Add a host redirect in .htaccess, nginx or your host's control panel. Check no plugin or physical robots.txt file differs from the virtual one.
Set the primary domain
In Settings > Domains, set your primary domain. Shopify redirects the other connected domains to it.
Edit the file if needed
Shopify generates robots.txt from the robots.txt.liquid theme template. Edit that template, not a separate file.
Pick the default domain
In Project settings > Publishing, set the default domain. Webflow redirects the other one to it.
Edit robots.txt
Edit it under Project settings > SEO and publish. Check that the webflow.io staging domain has indexing turned off, as intended.
Set the primary domain
In Domains, set the primary domain so the others redirect to it.
Edit robots.txt
Use the robots.txt editor in SEO tools and check the result on the primary domain.
Set the primary domain
In Settings > Domains, choose the primary domain. Squarespace redirects the rest to it.
Check the file
Squarespace generates robots.txt automatically. Check it on the primary domain only.
Add a catch-all host redirect
Use the nginx snippet below or the equivalent in Apache or your CDN. It sends every other host to the canonical one.
server {
listen 80;
listen 443 ssl;
server_name example.com www.example.com;
# ssl_certificate lines go here
if ($host != "example.com") { return 301 https://example.com$request_uri; }
if ($scheme = http) { return 301 https://example.com$request_uri; }
}Before
- https://www serves the clean file
- http://www serves an old Disallow: / file
- /robots.txt not redirected on non-www
- Crawlers see different rules per link
After
- Every host 301 redirects to one canonical host
- One robots.txt with a Sitemap: line
- Same rules whichever URL a crawler starts from
How to confirm it's fixed
- All four host and protocol versions of /robots.txt end on the same final URL
- The final response is 200 with content type text/plain
- The file contains no unintended Disallow: / rule
- Search Console shows a successful fetch for the canonical host
- A sample page on each old host redirects to the canonical page with a 301
How to prevent it happening again
- Keep redirect rules in one place (server, CDN or platform) and document them
- Recheck all hostnames after migrations, SSL changes, CDN changes or domain moves
- Keep robots.txt in version control and review changes before release
- Never copy staging config to live without a robots.txt review
- Add a calendar reminder to run the curl check monthly
How FunnelGuard handles this
FunnelGuard does not check this yet. Comparing robots.txt across hostnames is a possible future check, but today it is not part of what the service monitors.
What FunnelGuard does do is run your real customer journeys (lead forms, checkouts, booking and chat buttons) on a schedule from the EU or the US, check the tracking hits sent to ad and analytics platforms, and confirm test leads reach your inbox and CRM. That catches funnel breaks, but not crawler access rules.
To watch for this issue, run the curl loop above on a schedule, and keep the canonical host verified in Google Search Console, where the robots.txt report shows fetch errors. A free read-only FunnelGuard website audit is also available if you want a general look at your site.
Questions people ask
Does robots.txt apply to both www and non-www?
No. A robots.txt file applies only to the exact protocol, host and port it is served from. www.example.com and example.com are different hosts, so each needs to serve the intended file or redirect to the one that does.
Why is Google ignoring my robots.txt changes?
You may have edited the file on a different host than the one Google crawls. Check http, https, www and non-www versions. Google also caches robots.txt for up to about 24 hours, so changes can take time to show.
Should I redirect robots.txt from www to non-www?
Yes, if non-www is your canonical host. Google follows redirects for robots.txt, so a 301 from the other host to the canonical file is fine. Just make sure the final response is a 200 plain text file.
Does http vs https matter for robots.txt?
Yes. The http and https versions are treated as separate hosts. Redirect http to https for all paths, including /robots.txt, so crawlers always end on the https file.
How do I check robots.txt on all versions of my domain?
Use curl -IL on each of the four URLs (http and https, with and without www) and compare the status, redirect target and content. In Google Search Console, the robots.txt report shows what Google fetched for each host.
Do subdomains share the same robots.txt?
No. Each subdomain, such as blog.example.com, needs its own robots.txt file. Rules on the main domain do not apply to it.
Can a different robots.txt on one host hurt my rankings?
It can. If a host serves a blocking file and crawlers reach your pages through it, those URLs may not be crawled or updated. Redirecting every host to one canonical version removes that risk.
Related issues
- SEO-001robots.txt Disallow: / left over from staging blocks the whole siteFix guide
- SEO-005robots.txt returns 404 or HTML instead of plain textFix guide
- SEO-010robots.txt missing Sitemap: lineFix guide
- SEO-006robots.txt syntax errors or unsupported directives (noindex in robots.txt)Fix guide
- SEO-002robots.txt blocks a money page or landing page directoryFix guide
- SEO-004robots.txt returns 5xx so Google stops crawling the siteFix guide