Welcome! Log In Create A New Profile

Advanced

location /robots.txt conflict / issue

September 29, 2016 01:09PM
So this is one of those issues it is most likely a bad configuration but my robots.txt file is returning a 404 because of another location because I am disallowing people to access any text files but I do want to allow only the robots.txt to be accessed.

location /robots.txt {
root 'location/to/robots/txt/file';
}
#This is to stop people digging into any directories looking for files that only PHP etc should read or serve
location ~* \.(txt|ini|xml|zip|rar)$ {
return 404;
}

I have not tested but I believe I could fix the above by changing my config to this.
location /robots.txt {
allow all;
root 'location/to/robots/txt/file';
}
#This is to stop people digging into any directories looking for files that only PHP etc should read or serve
location ~* \.(txt|ini|xml|zip|rar)$ {
deny all;
}

Is that the only possible way to deny access to all text files apart from the robots.txt ?

http://www.networkflare.com/
Subject Author Posted

location /robots.txt conflict / issue

c0nw0nk September 29, 2016 01:09PM

Re: location /robots.txt conflict / issue

Francis Daly September 29, 2016 05:24PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 306
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready