How to Redirect PDF Files in WordPress Without Breaking Old Links

Ever updated a PDF in WordPress and worried about breaking links on your website. Even worse, on external platforms you do not control? It’s a common challenge: WordPress doesn’t natively support redirects for media files like PDFs. But with a clever workaround. You can keep those old links working while seamlessly pointing users to your new file.

Issue Background

 A client needed to update a PDF stored in their WordPress Media Library. The problem? Changing the filename would break every instance where that file had been shared.

For example:

 ❌ Old PDF URL: /wp-content/uploads/2024/02/old-document.pdf

New PDF URL: /wp-content/uploads/2025/03/updated-document-v2.pdf

Most WordPress hosts would not process redirects for static files like PDFs. Redirects usually work for pages. Not media assets.

Diagnosis

We ran a Standard redirect plugins and server redirects couldn’t handle this scenario. The fix required a creative solution at the file structure level—one that works with WordPress and preserves SEO. detailed audit of the import scripts and custom fields setup:

Solution

Step 1: Rename the Old File

Using SFTP or your hosting file manager, locate the original PDF and rename it, like this:  old-document-old.pdf

Step 2: Create a “Fake” Directory

Inside the same folder, create a directory using the exact same name as the old file (yes—with the .pdf extension):  /wp-content/uploads/2024/02/old-document.pdf/

Step 3: Add a Redirect File

In that new folder, create an index.php file containing this redirect code:

php
CopyEdit
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: /wp-content/uploads/2025/03/updated-document-v2.pdf");
exit();
?>

Now, whenever someone clicks the old PDF link, they’ll land on your new, updated version automatically.

Why It Works

  • Browsers try to load /old-document.pdf but find a folder instead.
  • That folder serves the index.php, which executes a 301 redirect to your new file
  • No broken links. No SEO losses. Just clean user experience.

Final Outcome

  • No need to manually update old links on your website—or anywhere else
  • Users go directly to your new document.
  • Search engines respect the 301 redirect, maintaining SEO continuity.

Need a Hand Managing Redirects or WordPress Media?

Let’s Fix It

Other Resources Post

Fix Weglot Redirection Loops on WordPress

Is your multilingual site redirecting users to the wrong language even after they switch manually? Here’s how we resolved a stubborn redirection loop even backend settings looked fine.

Fix Elementor Not Loading (Without Losing Content)

Editing your homepage in Elementor, only to see a blank screen? You’re not alone. At Integriti Studio, we recently helped a client resolve an issue where their Elementor editor wouldn’t load.

Add ZIP Code Restrictions in Gravity Forms

Want to restrict form submissions to a specific area? Here's how we helped a client block submissions from ZIP codes outside their service zone using a custom validation method in Gravity Forms.

View All Resources Post

Powered by Creativity,
Fueled by Caffeine.

Get Started