Created
May 1, 2017 18:19
-
-
Save nathanbrauer/a15bfb6c7da674ecc0adb85f4dc44001 to your computer and use it in GitHub Desktop.
Block robots on all domains except those whitelisted
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
# START: BLOCKING ROBOTS ON ALL ENVIRONMENTS EXCEPT LIVE-PROD | |
# If domain is NOT (www|uk|au|fr|de).marketo.com... | |
RewriteCond %{HTTP_HOST} !^(www|uk|au|fr|de)\.marketo\.com$ | |
# ...then set environment variable BLOCK_ROBOTS to 1 | |
RewriteRule .* - [E=BLOCK_ROBOTS:1] | |
# Now, if BLOCK_ROBOTS is present then set robots header | |
Header set X-Robots-Tag "noindex, nofollow" env=BLOCK_ROBOTS | |
# END: BLOCKING ROBOTS ON ALL ENVIRONMENTS EXCEPT LIVE-PROD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment