Skip to content

Instantly share code, notes, and snippets.

@koehn
Last active December 29, 2015 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koehn/7657865 to your computer and use it in GitHub Desktop.
Save koehn/7657865 to your computer and use it in GitHub Desktop.
mod_rewrite configuration to send either a 410 (Gone) or a robots file with disallow * for any request to a domain other than one I own. I needed this because some Chinese company had been leasing the IP address that I got and still had dozens/hundreds of domain names pointed at my IP; I didn't want my app server getting these and/or redircting …
RewriteEngine On
RewriteCond %{HTTP_HOST} !^.*koehn\.com$
RewriteRule ^robots\.txt$ /robots-off.txt [L]
RewriteCond %{HTTP_HOST} !^.*koehn\.com$
RewriteRule !^robots-off\.txt$ - [L,G]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment