Skip to main content

What does the Disallow directive do in robots.txt?

The Disallow directive in the robots.txt file tells search bots which pages or directories must not be crawled or indexed. It denies access to specified paths, so that the search engine does not enter certain sections of the site, for example service pages, admin panels, or duplicate content.

Example:

javascript
User-agent: * Disallow: /admin/ Disallow: /cart

In this case, bots will not crawl the /admin/ section or the /cart page.

It's important to understand: Disallow does not fully hide a page from the search engine. If external links point to the disallowed page, it can still appear in the results, but without content. For complete hiding, noindex (in a meta tag) or a prohibition via HTTP headers is used.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.