Free auditStart free
GuideDrupal · Crawling

Drupal robots.txt

Find Drupal's default robots.txt, make narrow crawl-rule changes, and confirm the file is served from the right domain root.

4 min
read
5
sources
Oct 24, 2026
updated
Scaplet Editorial Team
author
In one line

Drupal ships robots.txt at the web root. For one site, append your rules with Composer Scaffold so core updates don't overwrite them. Use the RobotsTxt module for multisite per-domain rules; its README says to delete or rename the root file so the module can serve /robots.txt. Test the public response. Crawl rules do not protect private pages or guarantee deindexing.

30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01How it works

Find the file Drupal actually serves

The standard Drupal robots.txt belongs at the top-level directory of the host, usually beside the web root entry point. In Drupal core's file (main branch on api.drupal.org) there are Disallow rules for /admin/, /core/, /profiles/ and user routes such as /user/login, plus Allow rules for /core/*.css$, /core/*.js$ and image formats such as svg, png and webp. Inspect the deployed file before adding rules; a robots.txt under a subdirectory does not apply to the whole hostname.
  1. 01

    Request the production endpoint

    Open https://example.com/robots.txt for every public hostname. Confirm a plain-text response and check that a CDN, reverse proxy, or subdirectory install is not serving a different file.

  2. 02

    Edit through the deployment source

    For a typical single-site Drupal install, change the file in your code or deployment artifact, not a server copy that the next deployment will replace. If the site is built with Composer, Drupal's Composer Scaffold plugin overwrites scaffold files such as robots.txt by default, so a hand edit can disappear on the next core update. Append your rules instead (example below).

  3. 03

    Retest critical assets and routes

    Check the rule against an important page, its rendered CSS and JavaScript, and any sitemap path. Test with Search Console's robots.txt report or URL Inspection when a crawl issue is suspected.

02Checklist

Use the RobotsTxt module for a real multisite need

The contributed RobotsTxt module is designed for a Drupal multisite codebase that needs different robots.txt output per site. Its project page says the physical root robots.txt must be deleted or renamed before the module can serve its own file. If the root file remains, the web server may return that static file before Drupal can handle the request.
  1. 01Install the module only when sites sharing one codebase need different crawl instructions. Release 8.x-1.6 lists Drupal ^9.3 || ^10 || ^11 as compatible; check the release feed for newer versions.
  2. 02After enabling it, request /robots.txt on each domain and confirm each host gets the intended rules.
  3. 03The module's own settings page is Configuration > Search and metadata > RobotsTxt. With Composer Scaffold, add "[web-root]/robots.txt": false to drupal-scaffold file-mapping so core stops re-creating the static file.
  4. 04If the module does not serve your file, its troubleshooting list asks whether you deleted or moved the webroot robots.txt, whether clean URLs are disabled, and whether the fast 404 feature is enabled.
  5. 05For one domain and one rule set, a maintained root file is usually the simpler solution.
03Checklist

Make a narrow rule and verify its effect

The append directive is documented in the Composer Scaffold README, which also says to use append and prepend where possible. The path is relative to your project root.
First2
Check whether an existing broader rule already covers the path before appending a new line.
Do not disallow a page when your goal is to have Google read its noindex directive; a blocked crawler cannot fetch that directive.
Next1
After deployment, check status code, content type, redirects, and the rules for representative URLs. Google generally caches robots.txt for up to 24 hours, and may cache it longer if refreshing fails (for example on timeouts or 5xx errors).
Then1
Use Sitemap: with the absolute production sitemap URL if you want to expose it through robots.txt; make sure the sitemap is reachable and contains canonical URLs.
composer.json: append your rules to core's robots.txt
"extra": {
  "drupal-scaffold": {
    "file-mapping": {
      "[web-root]/robots.txt": {
        "append": "assets/my-robots-additions.txt"
      }
    }
  }
}
Illustrative additions (the contents of my-robots-additions.txt)
User-agent: *
Disallow: /internal-search/

Sitemap: https://www.example.com/sitemap.xml

This is an example, not a Drupal default. Only disallow a path after confirming it exists and should not be fetched. Keep CSS, JavaScript, and image resources crawlable when Google needs them to render page content.

See Drupal's default robots.txt, the RobotsTxt module, Google's robots.txt introduction, and the noindex guide.

Sources · 5

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • drupal.org
  • drupalcode.org
  • google.com
  1. 01robots.txt | Drupal APIapi.drupal.org · checked 2026-10-24
  2. 02RobotsTxt module README | Drupal.orggit.drupalcode.org · checked 2026-10-24
  3. 03Composer Scaffold README | Drupal coregit.drupalcode.org · checked 2026-10-24
  4. 04Introduction to robots.txt | Google Search Centraldevelopers.google.com · checked 2026-10-24
  5. 05How Google interprets the robots.txt specification | Google Search Centraldevelopers.google.com · checked 2026-10-24
Questions

Asked a lot.

3 questions people ask next, answered from the sources on this page.

01Where is robots.txt in Drupal?

It is served from the top-level path https://your-domain.example/robots.txt. Drupal core ships a robots.txt in the web root; check the public URL because a subdirectory copy or cached file may not be the one crawlers receive.

02How do I edit robots.txt for a Drupal multisite?

The contributed RobotsTxt module generates robots.txt dynamically and lets you edit it per site from the web UI. Its README says to delete or rename the root file, otherwise the web server serves the static file first. Then test every domain.

03Can robots.txt remove a Drupal page from Google?

No. A disallow rule controls crawling and does not guarantee deindexing. Let Google crawl a public page to read noindex, or require authentication for private content.

Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane