Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save philipborbon/36562ee446ecdb1ca5947ac07cb6c1ae to your computer and use it in GitHub Desktop.
Save philipborbon/36562ee446ecdb1ca5947ac07cb6c1ae to your computer and use it in GitHub Desktop.
Robots.txt for Staging and Production. By adding these rewrite rules to your .htaccess file, robots_dev.txt will be served as robots.txt on any non-production server.
RewriteEngine On
# Robots.txt for Staging and Production -- change productiondomain.com to the actual url of your production site
RewriteCond %{HTTP_HOST} !productiondomain.com$ [NC]
RewriteRule ^robots.txt robots_dev.txt [L]
User-agent: *
Allow: /
User-agent: *
Disallow: /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment