Answer the question
In order to leave comments, you need to log in
How to prevent address indexing by a piece of URL in NGINX?
Google webmaster constantly gets addresses that are closed in robots txt with the wording "Indexed despite blocking in the robots.txt file". However, I do not know where and where Google finds them. When you go to the site using this URL, the code 404 is issued. Therefore, the robots meta tag will not help here.
Found another way to close such pages, using the X-Robots-Tag "noindex". In the manual from Google - there is an instruction on how to close using the X-Robots-Tag "noindex".
There is the following code for NGINX:
location ~* \.pdf$ {
add_header X-Robots-Tag "noindex, nofollow";
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question