Hello,
Thanks for contacting us and sorry for any inconvenience that might have been caused due to that.
A direct PDF file cannot be set as noindex since noindex is used in the HTML code and a PDF does not contain any HTML code. The best way to stop the files from indexing is to add a rule in the robots.txt file.
Hope this clarifies your doubts. Let us know if you need any other assistance.
I just saw one of the tickets from another person saying that he added “no index” to a pdf from the media section.
Also I’m pretty sure this is possible by adding a x-robots tag to the http header tag. I just need to know how I can do this.
Hello,
As my colleague mentioned, since PDFs are not loaded as HTML, the noindex tag cannot be applied to them. However, WordPress creates attachments pages for all attachments in the website and you can noindex those attachment pages by editing them.
Here’s a screencast for a quick reference:
https://i.rankmath.com/ss8EGK
If the Redirect Attachments option is not enabled (from Rank Math > General Settings > Links), then you can also add the noindex tag from the global settings of Attachment pages under Rank Math > Titles & Meta > Attachments > Media Robots Meta.
With that being said, adding a rule in the robots.txt file is sufficient to let search engines know that you do not wish to get those attachments indexed.
Hope this helps.
Thank you.
Thanks but in your link video, where you see rank math and edit the advanced option from below. I can’t se that. Why is that?
Hello,
The option to add the meta box in the attachment pages was available in a previous version and is no longer available. Thats why you are not able to add or see the meta box in the attachment pages. You can noindex all the attachment pages from WP Dashboard > Rank Math > Titles & Meta > Attachments:

And if you want to add the X-robots-tag to your pdf files then you can use the code given below in your .htaccess file:
<FilesMatch ".pdf$">
Header set X-Robots-Tag "noindex, noarchive, nosnippet"
</FilesMatch>
Hope this helps. Let us know if you need any other assistance.
Thanks.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.