How to redirect a PDF in WordPress


So you want to redirect a PDF from your old site to your new WordPress site?

When you migrate your site, in order to maintain your search engine rankings you generally want to set up 301 redirects for URLs from your original site to the corresponding URL on your new site. Search engines are likely to continue to show your old site links in searches for some time, and you don’t want users heading to a 404 page.

Redirecting PDFs works in the same way as redirecting pages. In your .htaccess file, a typical 301 redirect section will look like this, for a site keeping the same domain name:

#Begin 301 Redirects
Redirect 301 /sub-page/sub-sub-page
#End 301 Redirects

And like this for a site changing domain name:

#Begin 301 Redirects
Redirect 301
#End 301 Redirects

For PDFs, the process is exactly the same. Where it differs is when PDFs have been uploaded in the past with spaces in the file name (generally on older sites where the spaces have been retained in the file name). This means the original PDF URL was something like The problem is that the %20’s are not recognised when this URL is added to the .htaccess file. The way around this is to enclose the original URL in quotes, keeping the original spaces. Here is an example:

#Begin 301 Redirects
Redirect 301 "/wp-content/a fancy title.pdf"
#End 301 Redirects

Note: This works on Linux servers. If you are using an Apache server and still having issues, check out this article.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close