webzod
account

Remove the noindex header from the homepage on nginx

seo.indexability.noindex_header · effort: minutes

Why it matters

An X-Robots-Tag header with noindex tells search engines to keep the homepage out of their results, even though the page itself looks fine. It is often a leftover from a staging server or a security rule.

Staged change. Do this in stages and check each one before the next, so a mistake does not break your site or your mail.

The fix

  1. Check that it is not deliberate, then find the directive with the command in the snippet and remove or comment it out. Also check the application behind nginx.
  2. If the header comes from an application behind nginx, either fix it in the application or add proxy_hide_header X-Robots-Tag; to the location that proxies it (use fastcgi_hide_header X-Robots-Tag; for PHP-FPM).
  3. Run nginx -t, reload nginx, and run curl -sI on the homepage to check the header is gone.
bash
grep -rn "X-Robots-Tag" /etc/nginx/

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.