Last active
June 8, 2021 09:00
-
-
Save hieblmedia/c09fce90f03b5ed8cd2ed51bf78774d2 to your computer and use it in GitHub Desktop.
no-index header (X-Robots-Tag) + robots.txt for Develop/Testing/Stating subdomains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set X-Robots-Tag | |
<If "%{HTTP_HOST} =~ /^(develop|dev|test|testing|stage|staging)\./"> | |
Header set X-Robots-Tag "noindex, nofollow" | |
</If> | |
<IfModule mod_rewrite.c> | |
# Enable URL rewriting | |
RewriteEngine On | |
# .... | |
# Response robots_no.txt on robots.txt request for disallow contents (don't forget to put robots_no.txt in directory root) | |
RewriteCond %{HTTP_HOST} ^(develop|dev|test|testing|stage|staging)\. | |
RewriteRule robots\.txt$ robots_no.txt [NS] | |
# .... | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User-Agent: * | |
Disallow: / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment