{"id":842,"date":"2022-12-19T00:14:53","date_gmt":"2022-12-18T23:14:53","guid":{"rendered":"https:\/\/wp.catedu.es\/zgzsur\/?p=842"},"modified":"2022-12-15T18:16:12","modified_gmt":"2022-12-15T17:16:12","slug":"how-to-avoid-the-indexing-of-pdf-files-seo","status":"publish","type":"post","link":"https:\/\/wp.catedu.es\/zgzsur\/how-to-avoid-the-indexing-of-pdf-files-seo\/","title":{"rendered":"How to avoid the indexing of PDF files (SEO)"},"content":{"rendered":"\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=cpizaragozasur\" class=\"twitter-share-button\" data-size=\"large\">Twittear<\/a><\/div>\n<p><span>There are many situations for which a website\u00a0<\/span><strong><span>offers PDF files on its pages or products<\/span><\/strong><span>\u00a0, whether they are reports, catalogs or simply downloadable guides, for the use and enjoyment of its users.<\/span><\/p>\n<p><span>Now,\u00a0<\/span><strong><span>you may not want PDF files to be indexed by search engines and appear on the\u00a0<\/span><abbr class=\"c2c-text-hover\" title=\"\" data-hasqtip=\"0\"><span>SERPs<\/span><\/abbr><\/strong><span>\u00a0, and you would prefer your other content to be indexed rather than the files themselves.<\/span><\/p>\n<p><span>If this is your case, and you do not want your PDF files to appear in search engine results,\u00a0<\/span><strong><span>you have 2 ways to achieve it&#8230;<\/span><\/strong><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_40 counter-hierarchy ez-toc-counter ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\"><span>Index of contents<\/span><\/p>\n<p><span class=\"ez-toc-title-toggle\"><a class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" href=\"https:\/\/ayudawp.com\/evitar-indexado-pdf-seo\/#\"><label for=\"item-639aedf8b1a58\" aria-label=\"Table of Contents\"><\/label><input id=\"item-639aedf8b1a58\" type=\"checkbox\" \/><\/a><\/span><\/div>\n<nav>\n<ul class=\"ez-toc-list ez-toc-list-level-1 \">\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-1\" title=\"Do not index PDF files from robots.txt file\" href=\"https:\/\/ayudawp.com\/evitar-indexado-pdf-seo\/#No_indexar_los_archivos_PDF_desde_el_archivo_robotstxt\"><span>Do not index PDF files from robots.txt file<\/span><\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-2\" title=\"Do not index PDF files using the X-Robots tag\" href=\"https:\/\/ayudawp.com\/evitar-indexado-pdf-seo\/#No_indexar_los_archivos_PDF_usando_la_etiqueta_X-Robots\"><span>Do not index PDF files using the X-Robots tag<\/span><\/a><\/li>\n<\/ul>\n<\/nav>\n<\/div>\n<h2><span id=\"No_indexar_los_archivos_PDF_desde_el_archivo_robotstxt\" class=\"ez-toc-section\"><\/span><span>Do not index PDF files from robots.txt file<\/span><\/h2>\n<p><span>The first, very simple method is to add a policy to the file\u00a0<\/span><code>robots.txt<\/code><span>that PDF files should not be indexed.<\/span><\/p>\n<p><span>To do this, locate the file\u00a0<\/span><code>robots.txt<\/code><span>, which will normally be in the root folder of your installation, to edit it and add this line:<\/span><\/p>\n<pre><span>Disallow: \/*.pdf$<\/span><\/pre>\n<p><span>Normally, a\u00a0<\/span><code>robots.txt<\/code><span>WordPress default file would look like this:<\/span><\/p>\n<pre><span>User-agent: *<\/span><span>\r\nDisallow: \/wp-admin\/<\/span><span>\r\nAllow: \/wp-admin\/admin-ajax.php<\/span><span>\r\nSitemap: https:\/\/ayudawp.com\/wp-sitemap.xml<\/span><\/pre>\n<p><span>And, after adding the line, it should look like this:<\/span><\/p>\n<pre><span>User-agent: *<\/span><span>\r\nDisallow: \/wp-admin\/<\/span><span>\r\nAllow: \/wp-admin\/admin-ajax.php<\/span><span>\r\nDisallow: \/*.pdf$<\/span><span>\r\nSitemap: https:\/\/ayudawp.com\/wp-sitemap.xml<\/span><\/pre>\n<p><span>If the file does not exist, it is possible that you have a\u00a0<a href=\"https:\/\/ayudawp.com\/robots-txt-virtual-wordpress\/\">virtual\u00a0<\/a><\/span><a href=\"https:\/\/ayudawp.com\/robots-txt-virtual-wordpress\/\"><span>file<\/span><code>robots.txt<\/code><\/a><span>\u00a0, in which case you should create it manually.<\/span><\/p>\n<p><span>Now, you should know that not all search engines will listen to this instruction, Google will, but it is not certain that all of them will, so you still have to opt for the second option&#8230;<\/span><\/p>\n<h2><span id=\"No_indexar_los_archivos_PDF_usando_la_etiqueta_X-Robots\" class=\"ez-toc-section\"><\/span><span>Do not index PDF files using the X-Robots tag<\/span><\/h2>\n<p><span>The most effective method to prevent your PDF files from being indexed is to add an X-Robots tag to the headers of all the pages on your website.\u00a0To do this you must add the following to\u00a0<\/span><code>.htaccess<\/code><span>your installation file on an Apache server:<\/span><\/p>\n<pre><span>&lt;Files ~ \"\\.pdf$\"&gt;<\/span><span>\r\nHeader set X-Robots-Tag \"noindex, nofollow\"<\/span><span>\r\n&lt;\/Files&gt;<\/span><\/pre>\n<p><span>In case your server is NGINX, then you must add the\u00a0<\/span><code>nginx.conf<\/code><span>following to the file:<\/span><\/p>\n<pre><span>location ~* \\.pdf$<\/span><span>\r\n{<\/span><span>\r\nadd_header X-Robots-Tag \"noindex, nofollow\";<\/span><span>\r\n}<\/span><\/pre>\n<p><span>Save the changes to the file you&#8217;ve modified and the tag will be added\u00a0<\/span><code>X-Robots<\/code><span>to the header of your entire website, telling search engine bots not to index or follow PDF files.<\/span><\/p>\n\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=cpizaragozasur\" class=\"twitter-share-button\" data-size=\"large\">Twittear<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>There are many situations for which a website\u00a0offers PDF files on its pages or products\u00a0, whether they are reports, catalogs or simply downloadable guides, for the use and enjoyment of&#8230;<\/p>\n","protected":false},"author":355,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"yes","footnotes":""},"categories":[123],"tags":[],"class_list":["post-842","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/wp.catedu.es\/zgzsur\/wp-json\/wp\/v2\/posts\/842","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.catedu.es\/zgzsur\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.catedu.es\/zgzsur\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.catedu.es\/zgzsur\/wp-json\/wp\/v2\/users\/355"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.catedu.es\/zgzsur\/wp-json\/wp\/v2\/comments?post=842"}],"version-history":[{"count":1,"href":"https:\/\/wp.catedu.es\/zgzsur\/wp-json\/wp\/v2\/posts\/842\/revisions"}],"predecessor-version":[{"id":843,"href":"https:\/\/wp.catedu.es\/zgzsur\/wp-json\/wp\/v2\/posts\/842\/revisions\/843"}],"wp:attachment":[{"href":"https:\/\/wp.catedu.es\/zgzsur\/wp-json\/wp\/v2\/media?parent=842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.catedu.es\/zgzsur\/wp-json\/wp\/v2\/categories?post=842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.catedu.es\/zgzsur\/wp-json\/wp\/v2\/tags?post=842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}