CodeIgniter Forums
Remove PDFs From Google Search - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Remove PDFs From Google Search (/showthread.php?tid=84667)



Remove PDFs From Google Search - Mark H - 10-27-2022

Hello,

I would be very grateful if someone can advise me on how to correctly apply the 'noindex' to all PDF files within my CodeIgniter web site.
I have read that this can normally be achieved by use of the 'Filesmatch' tag within the .htaccess file as illustrated below, but I am not sure if the code snippet is in the correct format for CodeIgniter.
Many thanks in advance.

Code:
<FilesMatch "\.pdf$">
header set x-robots-tag: noindex
</FilesMatch>

Can I simply enter the above code within the root .htaccess file or do I need to apply a different method?
Many thanks in advance.


 

<


RE: Remove PDFs From Google Search - superior - 10-27-2022

(10-27-2022, 06:02 AM)Mark H Wrote: Hello,

I would be very grateful if someone can advise me on how to correctly apply the 'noindex' to all PDF files within my CodeIgniter web site.
I have read that this can normally be achieved by use of the 'Filesmatch' tag within the .htaccess file as illustrated below, but I am not sure if the code snippet is in the correct format for CodeIgniter.
Many thanks in advance.

Code:
<FilesMatch "\.pdf$">
header set x-robots-tag: noindex
</FilesMatch>

Can I simply enter the above code within the root .htaccess file or do I need to apply a different method?
Many thanks in advance.

See: https://webmasters.stackexchange.com/a/49124

PHP Code:
<Files "\.pdf$">
  Header set X-Robots-Tag "noindex, nofollow"
</Files



RE: Remove PDFs From Google Search - Mark H - 10-28-2022

Thank you so much for your kind response. I will utilise that code within the CodeIgniter .htaccess file and let you know if it resolves my issue.