Welcome! Log In Create A New Profile

Advanced

Re: Same root folder for multiple website different robots.txt

Vincent M.
August 07, 2021 07:36AM
Le 06/08/2021 à 18:21, Francis Daly a écrit :
> 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

Yes, helped me a lot. For the main domain I did to block robots-denyall.txt:

        location /robots-denyall.txt {
                return 404;
        }


And for the subdomain which I don't want to be referenced:

        location = /robots.txt {
                alias /var/www/mywebsite/prod/robots-denyall.txt;
        }

Thank you :)


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Same root folder for multiple website different robots.txt

Vincent M. August 06, 2021 10:22AM

Re: Same root folder for multiple website different robots.txt

Francis Daly August 06, 2021 12:22PM

Re: Same root folder for multiple website different robots.txt

Vincent M. August 07, 2021 07:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 95
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready