Last active
November 25, 2015 19:42
-
-
Save mkschell/610bef9c90133564e4be to your computer and use it in GitHub Desktop.
Used in the "web rules" in MODX Cloud, this set of directives allows you to serve robots.txt requests from MODX for your production hostnames, but blocks robot access on the modxcloud.com hostnames. This can be useful if you have a multi-context site and wish to serve different robots.txt responses per context/hostname.
This file contains hidden or 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
# Pass robots.txt requests to MODX unless the hostname matches modxcloud.com | |
# Note: robots.txt files on the filesystem will be completely ignored | |
set $roboloco "@modx-rewrite"; | |
if ($host ~* modxcloud\.com) { | |
set $roboloco "@robots-disallow"; | |
} | |
location ~ ^/robots\.txt$ { | |
try_files foobar $roboloco; | |
} | |
# Standard MODX rewrite | |
location / { | |
try_files $uri $uri/ @modx-rewrite; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment