Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Usage Milestone: Time Field for Drupal 8+ Module time_field crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Robots Rerouter

No security coverage Drupal 9–11
View on drupal.org

This module dynamically serves a different robots.txt file based on the website's environment. It ensures search engines only index your production site by serving a custom file for production and a disallow-all file for development and staging environments.

Robots Rerouter dynamically serves robots.txt based on environment. Prevents search engine indexing of non-production sites with minimal config.

Features

Robots Rerouter serves a different robots.txt response depending on the current domain.

βœ… Serves a custom robots.txt for production
🚫 Serves a disallow-all fallback for non-production environments (QA, Stage, Dev)
πŸ” Prevents accidental indexing of staging/test sites by search engines
πŸ›  Admin config form allows you to:
- Define the production hostname (e.g. www.example.com)
- Specify file paths for both production and fallback robots.txt

🧩 Smart behavior:
- Automatically creates the folders and files under public:// if they don’t exist
- Ensures secure, sandboxed file handling even on hosted environments like Acquia

Use Cases:
- You're managing multiple environments and want only the live site indexed
- You've seen Google index staging/dev accidentally before and need a safety net
- You're using CI/CD or Composer-based deployments and want to avoid .htaccess hacks

Post-Installation

After enabling the module:

1. Visit:
/admin/config/search/robots-rerouter

2. Configure:
- Production Hostname (e.g., www.example.com)
- Production File Path: e.g., robots/good_robots.txt
- Fallback File Path: e.g., robots/nocrawl_robots.txt

3. On save:
- Any missing folders or files will be automatically created in public://

Then when a user visits /robots.txt:
- If the domain matches your production hostname, it serves the production file
- Else, it serves the disallow-all fallback file

Additional Requirements

- No contributed modules are required.
- Files are created automatically under public://, but you may optionally upload your own content (especially the production robots.txt).
- Example fallback content:
User-agent: *
Disallow: /

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Aug 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.0 Stable 9–11 Aug 7, 2025
1.0.x-dev Dev 9–11 Aug 7, 2025