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