Reputation: 11
I use the following script :
https://www.html2pdf.fr/en/home
This script convert my php file to pdf file.
Example the url : mywebsite.com/pdf/url.php?id=8 will generate a PDF file. Another example : https://github.com/spipu/html2pdf/blob/master/examples/example01.php
I don't want the google robot to index these pages.
I added the code below in my htaccess file but it doesn't prevent google from crawling the page because it's in PHP : #Block indexing of Word and PDF files <files ~ ".(doc|docx|pdf)$"> Header Set X-Robots-Tag "noindex, nofollow
I can't block it how do I do it?
Upvotes: 1
Views: 283
Reputation: 7102
You can add X-Robots-Tag HTTP Response header in the script that generates your PDF file.
Example: header("X-Robots-Tag: noindex, nofollow", true);
Upvotes: 0