Same root folder for multiple website different robots.txt

Francis Daly francis at daoine.org
Fri Aug 6 16:21:07 UTC 2021


On Fri, Aug 06, 2021 at 04:20:56PM +0200, Vincent M. wrote:

Hi there,

> Is it possible to tell the second server to link the file robots.txt to
> another file like robots-pro.txt?

Either of

  location = /robots.txt { alias /var/www/website/prod/robots-pro.txt; }

  location = /robots.txt { try_files /robots-pro.txt =404; }

should work.

In the first case, you list the absolute file name. In the second,
you list the file within the normal "root" directory.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list