1

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" 
  deliver("/path/to/global/deny/robots.txt")
Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
chmod777
  • 11
  • 1

1 Answers1

1

This can be as simple as

<VirtualHost *:80>
  ServerName our-internal-devel-domain.de>
  Alias /robots.txt /path/to/global/deny/robots.txt 
</VirtualHost>
Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47