Check 17.11 · Videos, PDFs and multimedia

Optimize public PDFs

Inventory your public PDFs, decide which to index, then serve them properly (headers, noindex, canonical) on Apache, Nginx, Cloudflare, AWS or WordPress.

Priority
Complementary
Difficulty
Intermediate
Estimated time
2 h to 1 day
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

Google, Bing and generative engines can read and display PDFs: technical data sheets, price lists, guides, reports, catalogs. Optimizing public PDFs means deciding for each one whether it should be indexed, then making it usable: real text, a filled-in title, a reasonable file size, a stable URL, correct HTTP headers and links to the site. Expected result: every indexable PDF is clean and attached to an HTML page, and those that should not be indexed carry a noindex or a canonical.

Why it matters

Google indexes PDFs like pages, based on the text it extracts from them. They appear in results labeled PDF, sometimes above the HTML page that covers the same subject. This causes three common problems:

  • The PDF takes the page's place: the visitor lands on a document with no navigation, no link to the offer and no detailed analytics tracking.
  • The PDF is unusable: a scanned document with no text, a title such as “Document1” or “Microsoft Word - devis_v3_final”, an 80 MB file. Googlebot only reads the first 64 MB of a PDF, and an image-only document only provides text if Google recognizes it through OCR (optical character recognition).
  • The PDF is outdated: an old price list or an old user manual stays indexed for years, because nobody thinks to remove it.

According to Google, links in a PDF are followed and can pass signals like HTML links. A well-built PDF therefore points to your pages; a neglected PDF is a dead end.

For generative engines, a text PDF remains readable, but nothing is documented about how ChatGPT, Claude or Perplexity handle PDFs during their searches. The cautious rule: critical information must also exist in HTML. See avoid relying solely on a PDF (opens in a new tab).

What it improves

  • Indexing Only useful PDFs are indexed; duplicates and outdated versions drop out of the index.
  • Click-through rate A descriptive title replaces a file name or a default title in results.
  • Qualified traffic The PDF's links bring readers back to the site, and the associated HTML page captures searches.
  • Accessibility Real text, structure and language make the document readable by screen readers.
  • AI citations Possible but undocumented effect. A well-titled text PDF is easier to cite than a scan; no practice guarantees a citation.

How to check

1. List indexed PDFs. In Google, site:example.com filetype:pdf gives an overview, incomplete but useful. Complete it with a crawl (Screaming Frog, PDF filter) and a server listing:

find /var/www/example/public -iname "*.pdf" -printf "%s\t%p\n" | sort -rn | head -30

2. Check a PDF's headers.

curl -s -o /dev/null -D - https://example.com/docs/guide-entretien-chaudiere.pdf | grep -i -E "^HTTP|content-type|content-disposition|x-robots-tag|^link|content-length"

Compliant result for a PDF to be indexed:

HTTP/2 200
content-type: application/pdf
content-length: 1843200

No x-robots-tag: noindex, no forced content-disposition: attachment, no redirect to a login page.

3. Check the content. With the free Poppler utilities:

pdfinfo guide-entretien-chaudiere.pdf | grep -E "Title|Pages|Tagged|File size"
pdffonts guide-entretien-chaudiere.pdf | head -5

An empty or generic title is fixed with PDF metadata (opens in a new tab). An empty font list indicates a PDF with no text: see check that PDFs contain selectable text (opens in a new tab).

4. Inspect in Search Console. URL inspection accepts a PDF's URL and shows whether it is indexed and which canonical Google selected.

How to implement

Before you start

Build an inventory, then decide on one action per PDF:

PDF Associated HTML page Status Decision Technical action
/docs/guide-entretien-chaudiere.pdf /guides/entretien-chaudiere/ (same content) Indexed Keep as a download, index the HTML page HTTP canonical to the HTML page
/docs/fiche-technique-pac-8kw.pdf /produits/pompe-a-chaleur-8kw/ (summary) Indexed Index the PDF, which contains the technical details Title, text, links to the product page
/docs/tarifs-2023.pdf None Indexed Outdated 301 redirect to /tarifs/
/docs/internes/procedure-sav.pdf None Indexed Must not be public Remove, or protect with authentication

Fictitious examples. Decision rules:

For each PDF you keep and make indexable:

  1. Real text, selectable, in the declared language.
  2. A title in the document properties, and a descriptive file name in lowercase with hyphens (guide-entretien-chaudiere.pdf, not Doc_Final_V3 (2).pdf).
  3. A reasonable file size: compressed images, no pages scanned in high resolution. With Ghostscript: gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -sOutputFile=guide-leger.pdf guide.pdf, then check that the images are still legible.
  4. Links to the site in the document: product page, contact, up-to-date HTML version.
  5. Date and version visible on the first page.
  6. A stable URL: update the file at the same location rather than publishing a new one for each version.
  7. A link from an HTML page with descriptive anchor text and the format stated: “Boiler maintenance guide (PDF, 1.8 MB)”.

The following sections show how to set the X-Robots-Tag and Link (canonical) headers depending on the environment. Replace the paths with your own.

Apache

Versions Apache 2.4.

In the virtual host configuration or in the root .htaccess (mod_headers module required):

AddType application/pdf .pdf

# Display PDFs in the browser rather than forcing a download
<FilesMatch "\.pdf$">
    Header set Content-Disposition "inline"
</FilesMatch>

# PDF duplicating an HTML page: canonical to the page
<Files "guide-entretien-chaudiere.pdf">
    Header set Link "<https://example.com/guides/entretien-chaudiere/>; rel=\"canonical\""
</Files>

# Old price list: redirect to the current page
Redirect 301 /docs/tarifs-2023.pdf https://example.com/tarifs/

To exclude an entire folder from the index, place this in /docs/brochures-salon/.htaccess:

<FilesMatch "\.pdf$">
    Header set X-Robots-Tag "noindex"
</FilesMatch>
sudo apachectl configtest && sudo systemctl reload apache2

Nginx

Versions Nginx 1.18 and later, including 1.30 (stable) and 1.31 (mainline).

In the server block of /etc/nginx/sites-available/example.com:

location = /docs/guide-entretien-chaudiere.pdf {
    add_header Link '<https://example.com/guides/entretien-chaudiere/>; rel="canonical"' always;
}

location ^~ /docs/brochures-salon/ {
    add_header X-Robots-Tag "noindex" always;
}

location = /docs/tarifs-2023.pdf {
    return 301 https://example.com/tarifs/;
}

The application/pdf type is already listed in mime.types. Be careful: an add_header directive in a location block cancels those inherited from the server block (security headers, cache). Repeat them in the block if needed or, since Nginx 1.29.3 (1.30 stable branch), add add_header_inherit merge; in the server block to combine headers.

sudo nginx -t && sudo systemctl reload nginx

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

Cloudflare caches PDFs by default. After replacing a file at the same URL, purge it: Caching > Configuration, “Custom Purge”, the PDF's URL.

To set a header without touching the server: from the rules overview, Create rule > Response Header Transform Rule, then edit the expression:

(starts_with(http.request.uri.path, "/docs/brochures-salon/") and ends_with(http.request.uri.path, ".pdf"))

Operation “Set static”, header X-Robots-Tag, value noindex. For a canonical, the same principle applies with the Link header and one rule per file. Redirects for old PDFs are set up in Rules > Redirect Rules or with Bulk Redirects.

AWS

Versions Amazon S3 and CloudFront, AWS CLI v2, November 2026.

S3: the type and display mode are set at upload, in the object's metadata:

aws s3 cp guide-entretien-chaudiere.pdf s3://example-docs/docs/guide-entretien-chaudiere.pdf \
  --content-type application/pdf --content-disposition inline --cache-control "max-age=86400"

S3 does not let you add an arbitrary X-Robots-Tag or Link header. Use CloudFront: Policies > Response headers > Create response headers policy, and in the custom headers section, add X-Robots-Tag: noindex (or Link), then attach the policy to a behavior whose path pattern targets the PDFs concerned (/docs/brochures-salon/*). After replacing a file, create an invalidation for its path.

Plesk

Versions Plesk Obsidian 18.0.

Open Websites & Domains > your domain > Apache & nginx Settings, then paste the location blocks from the Nginx section into “Additional nginx directives”. If Nginx does not serve static files directly, use the .htaccess from the Apache section instead.

cPanel

Versions cPanel & WHM 110 and later, Jupiter theme.

In File Manager, show hidden files and edit public_html/.htaccess with the block from the Apache section. For an entire folder, create an .htaccess file in that folder. To replace a PDF, upload the new file under the same name.

Shared hosting

At OVHcloud, o2switch, Ionos or Hostinger, the .htaccess from the Apache section works as is if mod_headers is active, which is generally the case. Test with the curl command from the “How to check” section. Without mod_headers, you are left with redirecting outdated PDFs and removing unnecessary files.

WordPress

Versions WordPress 6.4 to 7.1; Yoast SEO 20 and later, Rank Math 1.0, Enable Media Replace 4.

  • Location: PDFs uploaded to the Media Library are served from /wp-content/uploads/YYYY/MM/. The “Title” entered in the Media Library does not change the PDF's internal title.
  • Attachment pages: since WordPress 6.4, they are disabled by default on new installations. On an older site, Yoast SEO and Rank Math offer to redirect these pages to the file, which prevents empty pages from being indexed.
  • Replacing without changing the URL: WordPress adds a -1 suffix to the name when you upload a file with the same name again. The Enable Media Replace plugin replaces the file while keeping its URL (simple replace option).
  • Headers: SEO plugins do not set headers on files served directly by the server. Use the .htaccess (Apache section) or the host's Nginx configuration.

Shopify

Versions Shopify admin, all plans, November 2026.

PDFs are uploaded in Content > Files and served by Shopify's CDN. You cannot change their HTTP headers, so take care of the document itself (title, text, links) and link to it from the product page with descriptive anchor text. To replace an outdated PDF, upload the new version, update every link in the store to point to it, then delete the old file.

Laravel

Versions Laravel 11 to 13.

PDFs placed in public/ are served by the web server: apply the Apache or Nginx section. If a controller serves the files from storage/, set the headers in the response:

namespace App\Http\Controllers;

use Symfony\Component\HttpFoundation\BinaryFileResponse;

class DocumentsController
{
    public function show(string $document): BinaryFileResponse
    {
        $path = storage_path("app/public/docs/{$document}.pdf");

        abort_unless(is_file($path), 404);

        return response()->file($path, [
            'Content-Type' => 'application/pdf',
            'Content-Disposition' => "inline; filename=\"{$document}.pdf\"",
            'X-Robots-Tag' => 'noindex',
        ]);
    }
}
Route::get('/docs/{document}.pdf', [DocumentsController::class, 'show'])
    ->where('document', '[a-z0-9-]+')
    ->name('documents.show');

Remove X-Robots-Tag for documents that should be indexed.

Next.js

Versions Next.js 15 and 16 (App Router and Pages Router).

PDFs in public/ are served as is. Add the headers in next.config.js:

module.exports = {
  async headers() {
    return [
      {
        source: '/docs/brochures-salon/:path*',
        headers: [{ key: 'X-Robots-Tag', value: 'noindex' }],
      },
      {
        source: '/docs/guide-entretien-chaudiere.pdf',
        headers: [{ key: 'Link', value: '<https://example.com/guides/entretien-chaudiere/>; rel="canonical"' }],
      },
    ];
  },
};

headers() does not apply to a static export (output: 'export'): in that case, set the headers at the host.

Netlify

Versions Netlify, all plans, November 2026.

In a _headers file at the root of the publish directory:

/docs/brochures-salon/*
  X-Robots-Tag: noindex

/docs/guide-entretien-chaudiere.pdf
  Link: <https://example.com/guides/entretien-chaudiere/>; rel="canonical"

Common mistakes

  • Blocking PDFs in robots.txt to deindex them: Google can no longer read the noindex or the canonical, and the URL can stay indexed without content. Use X-Robots-Tag.
  • Relying on noindex for a confidential document: the file remains downloadable by anyone with the link.
  • Publishing each version at a new URL (tarifs-2024.pdf, tarifs-2025.pdf) without redirecting the old ones: outdated versions stay indexed.
  • Forcing Content-Disposition: attachment on all PDFs: the visitor coming from Google downloads a file instead of reading the document.
  • Scanning a printed document instead of exporting the source file: no reliable text, a large file.
  • Forgetting links in the PDF: the reader cannot get back to the site.
  • Not purging the CDN after a replacement: the old version keeps being served.

Frequently asked questions

Does Google index PDF files?

Yes, Google indexes PDFs and displays them in its results labeled PDF. It extracts their text and can apply character recognition to scanned pages, with no guarantee of quality. Googlebot reads the first 64 megabytes of a PDF. Links in the document are followed like HTML links. A password-protected or encrypted PDF is not indexed.

How do I prevent a PDF from being indexed?

To prevent a PDF from being indexed, send the X-Robots-Tag: noindex HTTP header when the server serves the file, because a PDF cannot contain a robots meta tag. Configure it in .htaccess on Apache, with add_header on Nginx, or with a Transform Rule on Cloudflare. Do not block the file in robots.txt: Google would no longer see the noindex directive.

Is an HTML page or a PDF better for SEO?

For important information, an HTML page is almost always better than a PDF. It fits into the navigation, carries structured data, can be measured in detail and is updated without changing files. A PDF remains useful as a downloadable or printable document. When both exist with the same content, index the HTML page and declare it as canonical in the PDF's HTTP header.

What should I do with an old PDF that still ranks well in Google?

If an old PDF still ranks well, do not delete it without a replacement. Redirect its URL with a 301 to the current version or to the HTML page covering the same subject, so you keep the links and the traffic. If it is still valid, update it at the same location, with a visible version date. Then purge the CDN cache.

Updated on

Topic checklist (PDF)

And now?

In the “Videos, PDFs and multimedia” topic

  1. Optimize video titles and descriptions
  2. Create relevant thumbnails
  3. Add subtitles and transcripts
  4. Add chapters
  5. Create a dedicated video page if strategic
  6. Implement VideoObject
  7. Create a video sitemap if needed
  8. Check access to videos and thumbnails
  9. Monitor video indexing
  10. Optimize related YouTube videos
  11. Optimize public PDFs
  12. Check that PDFs contain selectable text
  13. Fill in PDF titles and metadata
  14. Offer an HTML version of critical resources
  15. Provide a text alternative for charts