You already should have a robots.txt
file, now you just need to create a robots-off.txt
file in the same directory as the robots.txt
file. This blocks all legitimate search engines.
User-agent: * Disallow: /
The below code is simple! It just checks the HTTP_HOST
to see if it starts with "development", and if so (development.site.com
) it internally rewrites (not redirects) requests for /robots.txt
to /robots-off.txt
### ### Alt robots.txt ala askapache.com/htaccess/alternate-robots-txt-rewrite.html ### RewriteCond %{HTTP_HOST} ^development.*$ [NC] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*robots\.txt.*\ HTTP/ [NC] RewriteRule ^robots\.txt /robots-off.txt [NC,L]