I'd like to noindex a group of PDFs within a certain folder. There are other PDFs on site that I do want indexed, so I want to avoid using

<FilesMatch ".pdf$">
Header set X-Robots-Tag "noindex, nofollow"

The folder will be named "pdf-ns". Is there a way to only noindex only this group?

  • Is this in .htaccess or your server config?
    – MrWhite
    Mar 10, 2015 at 15:25

1 Answer 1


Yes, just place that rule inside of its own .htaccess file within the directory containing those PDFs. It will only affect them (and any in subdirectories of that directory). That rule does not have to be in your main root web directory. You are allowed to place .htaccess files in subdirectories as well.

If you have a mix of PDFs in a directory, some of which you want blocked and some of which you do not, you would either need to separate them into their own directory and use the rule above, or redefine your rule to list the PDFs you do want blocked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.