Sub topic 6
Reading noindex and robots.txt reasons
This chapter assumes you have a verified Search Console property and can read an HTTP response header and a page's HTML source. It also assumes you know what robots.txt does in general and have already opened the Page indexing report. Here you will learn what two reasons mean, how they differ from each other, and why combining them breaks things.
The two reasons at a glance
In the Not indexed table, two reasons tell you that your own configuration kept a URL out of Google:
- Excluded by 'noindex' tag: Google crawled the page, found a noindex instruction, and left the page out of the index.
- Blocked by robots.txt: Google did not crawl the page, because a rule in robots.txt forbids it.
Both are often intentional. Internal search results, cart pages and thank-you pages should usually appear under one of these reasons. The question is always whether the URLs listed are the ones you meant to exclude.
The two mechanisms work at different stages:
| Row | noindex | robots.txt Disallow |
|---|---|---|
| Stage it controls | Indexing | Crawling |
| Does Google fetch the page? | Yes, it must, to see the directive | No |
| Where the rule lives | Page HTML or HTTP response header | `/robots.txt` at the host root |
| Search Console reason | Excluded by 'noindex' tag | Blocked by robots.txt |
| Reliably keeps URL out of results? | Yes, once seen | No. A blocked URL can still be indexed from links |
How noindex works
A noindex instruction tells search engines not to keep the page in their index. You can deliver it in two ways.
The robots meta tag
Put this in the <head> of an HTML page:
<meta name="robots" content="noindex">You can target Google only by using name="googlebot" instead of name="robots". If both tags exist, Google combines them and applies the most restrictive result. A page can therefore be excluded by a googlebot meta tag you forgot about, even when the robots tag says index.
The X-Robots-Tag header
Files that have no HTML head, such as PDFs and images, need an HTTP header instead:
HTTP/1.1 200 OK
Content-Type: application/pdf
X-Robots-Tag: noindexSearch Console reports this with the same reason, "Excluded by 'noindex' tag". The report does not say which delivery method was used. You find that out by inspecting the URL (see below) or by reading the raw response.
Headers are often set in bulk, in a server or CDN configuration. One misplaced rule can add noindex to thousands of URLs, and nothing in the page source will show it.
What noindex is not
- noindex inside robots.txt is not supported. Google stopped honoring it in 2019, so a
Noindex:line there does nothing. - noindex does not stop crawling. Google keeps revisiting a noindexed page, though over time it may do so less often.
- noindex is a directive, not a hint. Unlike a canonical, Google follows it when it sees it.
How robots.txt blocking works
A robots.txt rule such as this one stops crawling of everything under /search/:
User-agent: *
Disallow: /search/URLs matching the rule appear as Blocked by robots.txt. Google never requests those pages, so it knows nothing about their content, their meta tags or their headers.
Two consequences follow.
- A blocked URL can still end up in search results. If other pages link to it, Google can index the bare URL with no description. When that happens, Search Console shows the warning Indexed, though blocked by robots.txt. Google does not recommend this state, because the listing is unpredictable.
- robots.txt is a crawl control, not an index control. If your goal is "never show this page", blocking is the wrong tool on its own.
The conflict: noindex plus Disallow
This is the most common mistake in this area. Suppose a page has <meta name="robots" content="noindex"> and the same URL is also disallowed in robots.txt. Google obeys the Disallow and never fetches the page. It therefore never sees the noindex tag. If links point at the URL, it can still be indexed.
flowchart TDSince that block is not a valid diagram form, here is the decision flow in the correct format:
The fix depends on what you want:
- You want the page out of Google entirely. Remove the Disallow rule, keep the noindex, and wait for Google to recrawl. After the URL shows as "Excluded by 'noindex' tag", you may add the Disallow again if you need to save crawl budget, but doing so is optional and rarely needed.
- You want the page indexed. Remove the noindex, and make sure robots.txt allows the URL.
- You want to save crawling on a huge low-value section. Use Disallow, and accept that stray URLs may occasionally be indexed without content.
Deciding whether a listing is a problem
Open the reason, then look at the example URLs. Compare them with what you intend.
Expected cases:
- Internal search, filter, sort and session URLs.
- Cart, checkout, account and login pages.
- Thank-you and confirmation pages.
- Staging copies you never wanted public.
Problem cases:
- Product, category, article or landing pages you want to rank.
- URLs that are in your submitted sitemap. A sitemap says "index this", and noindex or a Disallow says the opposite. Use the All submitted pages filter to find these contradictions quickly.
- A sudden jump in the count, especially right after a release or migration.
Typical causes of accidental noindex:
- A staging setting such as "Discourage search engines from indexing this site" carried into production.
- A template or SEO plugin applying noindex to a whole post type.
- A server or CDN rule adding
X-Robots-Tag: noindexto a path pattern that is too broad. - A development robots.txt containing
Disallow: /deployed to the live host.
Confirming with URL Inspection
Do not trust the report alone. Paste one affected URL into the URL Inspection tool and check these fields:
- Crawl allowed? "No: blocked by robots.txt" confirms a robots.txt problem.
- Indexing allowed? "No: 'noindex' detected in 'robots' meta tag" or "in 'X-Robots-Tag' http header" tells you which delivery method is in play.
- Page fetch. "Failed: Blocked by robots.txt" means the page was never retrieved.
The report can lag behind reality, so a URL you already fixed may still be listed. Running Test live URL shows the current state, which tells you whether the fix is in place before Google recrawls.
You can also check robots.txt itself in the robots.txt report under Settings. It shows which files Google found and when it last fetched them. Google caches robots.txt, often for up to a day, so a corrected file may take time to take effect.
Checking a URL yourself
The script below does a rough local check of the same three things: robots.txt permission, an X-Robots-Tag header, and robots meta tags. It uses only the standard library.
import sys
import urllib.request
import urllib.robotparser
from html.parser import HTMLParser
from urllib.parse import urlsplit
class RobotsMetaParser(HTMLParser):
"""Collects <meta name="robots|googlebot"> directives."""
def __init__(self):
super().__init__()
self.directives = []
def handle_starttag(self, tag, attrs):
if tag != "meta":
return
attributes = dict(attrs)
name = (attributes.get("name") or "").lower()
if name in ("robots", "googlebot"):
content = (attributes.get("content") or "").lower()
self.directives.append((name, content))
def check(url):
parts = urlsplit(url)
robots_url = f"{parts.scheme}://{parts.netloc}/robots.txt"
parser = urllib.robotparser.RobotFileParser()
parser.set_url(robots_url)
parser.read()
allowed = parser.can_fetch("Googlebot", url)
print(f"robots.txt allows Googlebot: {allowed}")
if not allowed:
print("A noindex on this page would not be seen by Google.")
request = urllib.request.Request(
url, headers={"User-Agent": "Mozilla/5.0 (indexing-check)"}
)
with urllib.request.urlopen(request, timeout=15) as response:
header_values = response.headers.get_all("X-Robots-Tag") or []
body = response.read(500_000).decode("utf-8", errors="replace")
header_noindex = any("noindex" in value.lower() for value in header_values)
print(f"X-Robots-Tag header: {header_values or 'none'}")
meta = RobotsMetaParser()
meta.feed(body)
meta_noindex = any("noindex" in content for _, content in meta.directives)
print(f"Meta robots tags: {meta.directives or 'none'}")
if header_noindex or meta_noindex:
print("Result: noindex found. Google will exclude this page.")
else:
print("Result: no noindex found.")
if __name__ == "__main__":
if len(sys.argv) != 2:
sys.exit("Usage: python check_index.py https://www.example.com/page/")
check(sys.argv[1])Treat the output as a quick screen. Python's robotparser does not match Google's handling of wildcards and rule precedence in every case, and your server may answer differently to a real Googlebot request. URL Inspection is the authority.
Fixing and validating
- Decide whether the URL should be indexed.
- If yes, remove the noindex tag or header, or the Disallow rule. Check the source, the response headers and robots.txt, since any of the three can be the cause.
- Run Test live URL in URL Inspection to confirm that crawling and indexing are now allowed.
- Use Request indexing for a few important URLs, or Validate fix on the reason for a larger batch. Validation takes days to weeks, and the status moves to Passed once Google has recrawled the sample and found the problem gone.
- If the URLs should stay excluded, there is nothing to fix. Check that they are not in your sitemap, so the report stops mixing intentional and accidental cases.
If a page is already indexed and you add noindex, expect it to drop out only after the next crawl. Blocking it in robots.txt at the same time delays that, because Google can no longer fetch the page to see the new tag.
Quick reference
- Excluded by 'noindex' tag: the page was fetched, and noindex was found in a meta tag or the
X-Robots-Tagheader. - Blocked by robots.txt: the page was not fetched because of a Disallow rule.
- Indexed, though blocked by robots.txt: the URL is indexed without content because of links. Decide whether you want it indexed, then use noindex with crawling allowed if you do not.
- Never rely on Disallow to keep a URL out of results, and never combine it with noindex on the same URL.
Exercise
A site owner added <meta name="robots" content="noindex"> to every page under /private-offers/ and also added Disallow: /private-offers/ to robots.txt. Months later, a few of these URLs still show in Google results with no description, and Search Console lists them as "Blocked by robots.txt". Why is this happening, and what should the owner change to remove them from results?
Show answer
The Disallow rule stops Google from fetching the pages, so Google never sees the noindex tag. Other pages link to the URLs, so Google can still index the bare URLs. To remove them, delete the Disallow rule so Google can crawl the pages, keep the noindex tag, and wait for a recrawl. The reason then changes to "Excluded by 'noindex' tag". Using URL Inspection with Test live URL confirms that crawling and indexing are in the expected state.
Exercise
The "Excluded by 'noindex' tag" reason lists a PDF price list that you want indexed. You checked the PDF and it has no HTML, so no meta tag can be responsible. Where should you look, and what do you look for?
Show answer
Look at the HTTP response headers for the PDF, through URL Inspection (Indexing allowed? and the page fetch details) or a header check such as the script in this chapter. The cause is an X-Robots-Tag: noindex header, probably set by a server or CDN rule that matches PDF files or the folder they are in. Remove or narrow that rule, then run Test live URL and Validate fix.