Does WP Ghost Rewrite PDF and Upload Links on the Frontend?

Moved

This tutorial has moved to the new WP Ghost Knowledge Base where each feature is presented in detail.

View on new site

Yes. When you change the uploads path in WP Ghost, the plugin automatically rewrites all links to PDFs, documents, images, and other uploaded files on the frontend. You don’t need to manually update any buttons, download links, or embedded file references. Everything updates automatically in the HTML output.

How Does WP Ghost Rewrite Upload Links on the Frontend?

When you change the uploads path in WP Ghost > Change Paths > WP Core Security (for example, changing /wp-content/uploads/ to /storage/), WP Ghost processes the HTML output as WordPress generates each page. Every URL that previously pointed to /wp-content/uploads/ is automatically replaced with your custom path. This includes PDF download links, document embeds, image sources, video and audio files, and any other media hosted in your uploads directory.

For example, a PDF link that previously appeared as yourdomain.com/wp-content/uploads/2025/03/report.pdf becomes yourdomain.com/storage/2025/03/report.pdf. The file itself hasn’t moved. WP Ghost uses server rewrite rules to route requests from the new URL to the original file location. The PDF loads, the link works, and the /wp-content/uploads/ path is gone from your source code.

Do I Need to Update Buttons or Links Manually?

No. WP Ghost handles the rewriting at the output level, which means any link generated by WordPress, your theme, or a plugin is automatically updated. This covers download buttons created with page builders like Elementor or Divi, links inserted through the WordPress editor, PDF embeds in posts and pages, WooCommerce downloadable product files, and links generated by gallery or media plugins.

The only exception is if you have hardcoded links outside of WordPress, for example in a custom HTML file or an external system that references your old upload URL. Those links will still point to the old path. If you’ve also hidden the old path with Hide WordPress Common Paths, those external links will get a 404. To keep them working, use the redirect from old paths feature instead of hiding.

What About PDFs Embedded in Iframes?

PDF embeds work the same way as links. The URL in the iframe source is rewritten to use the new path. However, if you’ve enabled the X-Frame-Options: SAMEORIGIN security header in WP Ghost > Firewall > Header Security, iframes loading content from external domains may be blocked. This is a security feature that prevents clickjacking, not a bug. If you need to embed PDFs from external sources, adjust the X-Frame-Options setting. For details, see the PDFs and iframes troubleshooting guide.

What About Links in Cached Pages?

If you use a caching plugin, cached pages are generated once and served statically. WP Ghost processes the output before the caching plugin saves the page, so cached versions already contain the new paths. If you change your uploads path after pages are already cached, clear the cache so your caching plugin regenerates pages with the updated URLs. For best results, enable Change Paths in Cached Files under WP Ghost > Tweaks so that minified and combined CSS/JS files also reflect the new paths.

For the complete uploads path tutorial, see the change uploads path guide.

Frequently Asked Questions

Does this work with WooCommerce downloadable products?

Yes. WooCommerce stores downloadable product files in wp-content/uploads/. When you change the uploads path, download links for WooCommerce products are rewritten automatically. Customers receive the correct file through the new URL. WP Ghost is fully compatible with WooCommerce.

Will changing the uploads path break existing links in my email newsletters?

If you’ve sent emails containing direct links to files using the old /wp-content/uploads/ path, those links will point to the old URL. If you’ve hidden the old path, they’ll get a 404. To prevent this, use the redirect images from old paths feature, which redirects old URLs to new ones instead of blocking them.

Does this affect my SEO or image indexing?

Images and files keep loading normally at the new URLs. If Google has already indexed your files under the old paths, it will re-index them at the new URLs over time. Resubmit your sitemap in Google Search Console to speed this up. The transition doesn’t hurt rankings.

Does WP Ghost physically move my uploaded files?

No. WP Ghost never moves, renames, or modifies any file. Your PDFs, images, and documents stay in wp-content/uploads/ exactly where WordPress put them. The plugin creates virtual paths through URL rewrite rules. Deactivating WP Ghost restores all original URLs instantly.

Does WP Ghost modify WordPress core files?

No. All path rewrites use server configuration rules (.htaccess on Apache/LiteSpeed, hidemywp.conf for Nginx) and WordPress filters at runtime. No core files, theme files, or plugin files are modified. Deactivating restores all defaults instantly.