I want to redirect all requests on "robots.txt" if the domain contains ".our-internal-devel-domain.de". It should be server-wide, because when we develop a website and publish it over our test-domain, I dont want to have it on google so i want to deliver a deny-all robots.txt.

For testing purposes, these domains do exist even after launching the project, so if the domain doesn't contain our devel-domain, the normal robots.txt should be served.

For example some pseudocode, but I didn't manage to use it with mod_rewrite or Alias in apache conf:

if current_domain.contains("our-internal-devel-domain.de") && querystring == "robots.txt" 

This can be as simple as

<VirtualHost *:80>
  ServerName our-internal-devel-domain.de>
  Alias /robots.txt /path/to/global/deny/robots.txt 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.