색인·웹마스터 도구 · 공식 문서

X-Robots-Tag 로 PDF 색인 차단, Apache·NGINX 설정 순서

PDF 에는 메타 태그를 넣을 자리가 없으므로 웹 서버 설정으로 응답 헤더에 X-Robots-Tag: noindex 를 붙입니다. 구글 문서는 Apache 의 .htaccess·httpd.conf 와 NGINX 의 .conf 에 넣는 예시를 적었고, 그 파일 URL 은 robots.txt 로 차단하지 않아야 합니다.

가격표, 제품 카탈로그, 내부 양식 같은 PDF 도 링크가 있으면 검색 결과에 실립니다. 그런데 PDF 에는 <head> 가 없어 robots 메타 태그를 넣을 수 없습니다.

그래서 파일을 보내는 서버가 응답 헤더에 X-Robots-Tag 를 붙입니다. 규칙 값의 뜻은 「noindex nofollow 차이」 편에 자세히 적었습니다.

발견 01

HTML 이 아닌 파일은 메타 태그 대신 X-Robots-Tag 응답 헤더로 색인을 차단합니다

To block indexing of non-HTML resources, such as PDF files, video files, or image files, use the X-Robots-Tag response header instead.

PDF·동영상·이미지 같은 HTML 이 아닌 파일은 X-Robots-Tag 응답 헤더로 색인을 차단한다.

Google Search Central 「Robots meta tag, data-nosnippet, and X-Robots-Tag specifications」
헤더의 규칙예공식 문서 원문
메타 태그와 같은 규칙X-Robots-Tag: noindexAny rule that can be used in a robots meta tag can also be specified as an X-Robots-Tag. A response header can be used for non-HTML resources, such as PDFs, video files, and image files.robots 메타 태그에 쓰는 규칙은 모두 X-Robots-Tag 로도 쓸 수 있다. 응답 헤더는 PDF·동영상·이미지 같은 HTML 이 아닌 파일에도 쓸 수 있다.
여러 규칙X-Robots-Tag: noindex, nofollowMultiple X-Robots-Tag headers can be combined within the HTTP response, or you can specify a comma-separated list of rules.X-Robots-Tag 헤더는 여러 줄로 보내도 되고, 규칙을 쉼표로 이어 한 줄에 적어도 된다.
크롤러 지정X-Robots-Tag: googlebot: nofollow X-Robots-Tag: otherbot: noindex, nofollowThe X-Robots-Tag may optionally specify a user agent before the rules. Rules specified without a user agent are valid for all crawlers. The HTTP header, the user agent name, and the specified values are not case sensitive.X-Robots-Tag 는 규칙 앞에 사용자 에이전트를 적어 크롤러를 고를 수 있다. 사용자 에이전트를 적지 않은 규칙은 모든 크롤러에 적용된다. 헤더 이름·에이전트 이름·값은 대소문자를 가리지 않는다.
빙X-Robots-Tag: noindexEach of these tags can also be specified as X-Robots-Tag: in the response header for the page.이 태그들은 모두 응답 헤더의 X-Robots-Tag 로도 적을 수 있다.
크롤러 지정 줄의 otherbot 은 문서가 쓴 자리표시 이름입니다. 대소문자는 가리지 않습니다.

발견 02

구글 문서는 Apache 와 NGINX 설정 예시 3가지를 적었습니다

For example, to add a noindex, nofollow X-Robots-Tag to the HTTP response for all .PDF files across an entire site, add the following snippet to the site's root .htaccess file or httpd.conf file on Apache, or the site's .conf file on NGINX.

사이트 전체 PDF 에 noindex, nofollow 를 붙이려면 Apache 는 루트 .htaccess 또는 httpd.conf 에, NGINX 는 사이트 .conf 에 아래 설정을 넣는다.

Google Search Central 「Robots meta tag, data-nosnippet, and X-Robots-Tag specifications」
대상ApacheNGINX넣는 파일
사이트 전체 PDF<Files ~ "\.pdf$"> Header set X-Robots-Tag "noindex, nofollow" </Files>location ~* \.pdf$ { add_header X-Robots-Tag "noindex, nofollow"; }Apache 는 루트 .htaccess 또는 httpd.conf, NGINX 는 사이트 .conf
사이트 전체 이미지(png·jpg·gif)<Files ~ "\.(png|jpe?g|gif)$"> Header set X-Robots-Tag "noindex" </Files>location ~* \.(png|jpe?g|gif)$ { add_header X-Robots-Tag "noindex"; }위와 같음
PDF 파일 하나<Files "unicorn.pdf"> Header set X-Robots-Tag "noindex, nofollow" </Files>location = /secrets/unicorn.pdf { add_header X-Robots-Tag "noindex, nofollow"; }Apache 는 그 파일이 있는 폴더의 .htaccess, NGINX 는 사이트 .conf
코드는 구글 문서 「Practical implementation of X-Robots-Tag」의 예시 그대로입니다(줄바꿈만 공백으로).
설정 자리공식 문서 원문
서버 설정 파일You can add the X-Robots-Tag to a site's HTTP responses through the configuration files of your site's web server software. For example, on Apache-based web servers you can use .htaccess and httpd.conf files.웹 서버 소프트웨어 설정 파일로 X-Robots-Tag 를 응답에 붙일 수 있다. Apache 라면 .htaccess 와 httpd.conf 를 쓴다.
사이트 전체에 한 번에The benefit of using an X-Robots-Tag with HTTP responses is that you can specify crawling rules that are applied globally across a site. The support of regular expressions allows a high level of flexibility.응답 헤더로 걸면 사이트 전체에 한 번에 규칙을 적용할 수 있고, 정규식을 써서 대상을 유연하게 고를 수 있다.
이미지You can use the X-Robots-Tag for non-HTML files like image files where the usage of robots meta tags in HTML is not possible.메타 태그를 넣을 수 없는 이미지 파일 같은 HTML 이 아닌 파일에 X-Robots-Tag 를 쓴다.
파일 하나You can also set the X-Robots-Tag headers for individual static files: # the htaccess file must be placed in the directory of the matched file.파일 하나에만 X-Robots-Tag 를 걸 수도 있다. 이때 .htaccess 는 대상 파일과 같은 폴더에 둔다.
NGINX 의 ~*Regular expressions are specified with the preceding “~*” modifier (for case-insensitive matching), or the “~” modifier (for case-sensitive matching).정규식 location 은 앞에 ~* 를 붙이면 대소문자를 가리지 않고, ~ 를 붙이면 가린다.
마지막 줄은 nginx 공식 문서 「Module ngx_http_core_module」의 location 설명입니다.

NGINX 예시의 location ~* 는 대소문자를 가리지 않는 정규식이라 .PDF 와 .pdf 를 함께 잡습니다. Apache 예시의 <Files ~> 는 대소문자를 가리는지 확인한 뒤 씁니다.

httpd.conf 나 .conf 에 손댈 권한이 없다면 .htaccess 를 쓸 수 있는지 호스팅 업체나 서버 담당자에게 먼저 묻습니다.

발견 03

robots.txt 로 그 파일을 차단하면 X-Robots-Tag 는 읽히지 않고 무시됩니다

조건공식 문서 원문
헤더가 읽히는 때robots meta tags and X-Robots-Tag HTTP headers are discovered when a URL is crawled.robots 메타 태그와 X-Robots-Tag 는 URL 을 크롤링할 때 발견된다.
robots.txt 로 차단하면If a page is disallowed from crawling through the robots.txt file, then any information about indexing or serving rules will not be found and will therefore be ignored. If indexing or serving rules must be followed, the URLs containing those rules cannot be disallowed from crawling.robots.txt 로 크롤링이 차단된 페이지는 색인·노출 규칙을 찾지 못하므로 그 규칙은 무시된다. 색인·노출 규칙을 따르게 하려면 그 규칙이 든 URL 을 크롤링 차단하면 안 된다.
이미지도 같음In this case you must allow crawling the image URLs in order for Googlebot to be able to extract the noindex rule.이 경우 Googlebot 이 noindex 규칙을 읽을 수 있도록 이미지 URL 크롤링을 허용해야 한다.
완전히 없앨 파일Non-HTML files (like PDFs) should be completely removed from your server.PDF 같은 HTML 이 아닌 파일은 서버에서 완전히 지워야 한다.
마지막 줄은 서치 콘솔 「Removals」 도움말의 영구 삭제 항목입니다. 공개하면 안 되는 PDF 는 헤더가 아니라 서버에서 지웁니다.

발견 04

B2B·B2C·B2G 사이트마다 헤더를 거는 파일이 다릅니다

예시 ① 부품 제조사의 대리점용 가격표 PDF(B2B)

가격표가 검색에 나오면 대리점 가격이 일반 구매자에게 그대로 보입니다. 대리점 전용 폴더의 PDF 에만 X-Robots-Tag 를 겁니다.

다만 가격표는 링크만 알면 누구나 열 수 있습니다. 외부에 보이면 안 되는 파일이라면 로그인 뒤에 두거나 서버에서 지웁니다.

예시 ② 쇼핑몰의 상품 상세 이미지(B2C)

이미지 검색 유입이 필요 없는 장식 이미지 폴더에만 헤더를 겁니다. 상품 대표 이미지는 이미지 검색에서 상품을 찾는 경로가 될 수 있으니 그대로 둡니다.

예시 ③ 공공기관 누리집의 지난 공고 첨부 파일(B2G)

마감된 공고 PDF 가 계속 검색에 나와 민원 문의가 들어오는 경우입니다. 지난 공고 폴더에 헤더를 걸고, 새 공고 페이지는 그대로 둡니다.

기관 서버가 NGINX 라면 location 블록 하나로 폴더 전체에 걸 수 있습니다. 설정 변경은 서버 운영 부서에 위 표를 그대로 넘깁니다.

그럼 PDF 에 X-Robots-Tag 는 어떤 순서로 거나요?

  1. 검색에서 뺄 파일을 정합니다. 사이트 전체 PDF 인지, 특정 폴더·파일인지 범위를 적습니다.
  2. 그 파일 URL 이 robots.txt 로 차단되어 있지 않은지 봅니다. 차단되어 있으면 헤더가 읽히지 않습니다.
  3. 웹 서버 종류를 확인합니다(Apache 또는 NGINX). 호스팅 관리 화면이나 서버 담당자에게 묻습니다.
  4. 위 표의 설정을 해당 파일에 넣고, 서버가 바뀐 설정을 읽게 합니다.
  5. 터미널에서 curl -I 로 그 PDF URL 을 요청해 응답에 X-Robots-Tag: noindex 줄이 있는지 봅니다.
  6. 이미 검색에 나온 파일이라면 서치 콘솔 URL 검사로 다시 크롤링을 요청합니다.
  7. 적용 여부 확인은 「noindex 확인 방법」 편의 응답 헤더 확인 순서를 따릅니다.

조사 방법

  • Google Search Central 「Robots meta tag, data-nosnippet, and X-Robots-Tag specifications」 (문서 수정일 2026-03-24) · 최종 확인일 2026-10-25 · https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag
  • Google Search Central 「Block Search indexing with noindex」 (문서 수정일 2025-12-10) · 최종 확인일 2026-10-25 · https://developers.google.com/search/docs/crawling-indexing/block-indexing
  • Search Console Help 「Removals and SafeSearch reports tool」 · 최종 확인일 2026-10-18 · https://support.google.com/webmasters/answer/9689846
  • Google Search Central 「Remove images hosted on your site from search results」 (문서 수정일 2025-12-10) · 최종 확인일 2026-10-18 · https://developers.google.com/search/docs/crawling-indexing/prevent-images-on-your-page
  • Bing Webmaster Tools Help 「Robots meta tags and attributes that Bing supports」 · 최종 확인일 2026-10-25 · https://www.bing.com/webmasters/help/robots-meta-tags-and-attributes-that-bing-supports-5198d240
  • nginx 「Module ngx_http_core_module」 · 최종 확인일 2026-10-25 · https://nginx.org/en/docs/http/ngx_http_core_module.html
  • 설정 예시 3가지는 구글 문서 「Practical implementation of X-Robots-Tag」 절의 코드 블록입니다. 적용 순서 6단계는 위 문서들의 조건을 작업 차례로 묶은 편집 판단입니다.
  • 「여러 규칙」·「빙」 줄의 예와 curl -I 확인은 문서 예시가 아니라 설명용으로 적었습니다.
  • 예시 ①②③은 이해를 돕기 위해 만든 가상 상황이며, 실제 기업·기관의 사례가 아닙니다.
  • 구글 원문은 영어판(hl=en)이고, 도구·보고서 이름은 같은 문서 한국어판(hl=ko) 표기를 따랐습니다.