Skip to content

Instantly share code, notes, and snippets.

@nathanbrauer
Created May 1, 2017 18:19
Show Gist options
  • Save nathanbrauer/a15bfb6c7da674ecc0adb85f4dc44001 to your computer and use it in GitHub Desktop.
Save nathanbrauer/a15bfb6c7da674ecc0adb85f4dc44001 to your computer and use it in GitHub Desktop.
Block robots on all domains except those whitelisted
# 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