WordPress

7 Ways to Protect WordPress PDF Files

Published on 31. July, 2018

Nowadays, PDF has become a standard file format for many important documents. Many people have used PDF files to create and share their knowledge and stories with others across different platforms, systems, and devices while maintaining a more consistent layout compared to other document file formats such as Docx and Odt. As the most popular CMS on earth, WordPress allows you to upload and share your PDF files as well. The thing is, it can’t guarantee your PDF files will be safe once published.

Why You have to Protect PDF Files?

There are many reasons why you want to protect your WordPress PDF files. One of the main reasons is for commercial purposes. If you’re running an online business selling ebooks, for example, it’s certain that you want to stop non-members from downloading and sharing your ebook files for free. In many cases, you also want to protect your original content, digital assets, ideas, inventions, intellectual work and such. You definitely don’t want people to exploit and take advantage of your skills and hard-to-produce products. Last but not least, there are some personal and private documents that you just don’t want them to be made public.

Depending on your needs and circumstances, there are many different ways to protect and stop unwanted users from accessing your PDF files. Here are 7 ways you can protect WordPress PDF files. Let’s dive in.

Protect PDF Files Indirectly

One of the most common ways to share your documents with others is to embed their file URLs directly on your content.

Once you’ve uploaded and inserted your PDF files into a WordPress post or page, you can then restrict its access to indirectly protect these files inside the content. Let’s take a look at 3 different ways you can do so.

#1 Password Protect WordPress Page

This is the easiest way of all. You can just set a password to protect your post/page content against unauthorized direct access using a WordPress default feature. You don’t even have to install any extra plugins.

How to password protect your WordPress post/page:

  1. Create a new WordPress page or post under your admin panel as usual
  2. Edit Visibility in the right-hand menu from Public to Password protected
  3. Enter your password and Update the page/post

The drawback is you can set only one password per post/page. So if someone reveals the password, others will be able to access your content and PDF files. A workaround is setting multiple passwords per post/page using this Password Protect WordPress Page plugin.

#2 Automatically Expire & Change Post/Page URL

Another simple method yet offers more security to your WordPress content is to use Protect WordPress Pages & Posts plugin. This plugin basically blocks the original URLs of your page/post against the public and search engines. In return, it enables you to create a new “private” URL for you to access or share the post/page with others. You can create as many as private URL as you want as well as expire these links by clicks and dates.

Better yet, if you’re using this with Private Magic Links extension, you can embed these private pages/posts directly on your content and let it do the magic for you. Your WordPress page/post URL will expire in a preset time, say every 1 minute. Once expired, a new private URL will be automatically created and so on.

Unauthorized users will just see a 404 error page when accessing protected pages as their URLs will expire and keep changing in a very short amount of time. It’s a simple yet quite effective way of stopping people from sharing your WordPress pages and posts content with others. The plugin comes in useful especially when you want to protect public-facing pages such as “contact us” and “thank you” page from abuse.

How to block post/page URL using Protect WordPress Pages & Posts:

  1. Get and install Protect WordPress Pages & Posts plugin under WordPress admin panel
  2. Go to WordPress Pages/Posts
  3. Click “Protect this page” under “Protect Your Pages” column then “Auto-generate new link”

That’s all. Now your page content is blocked against both search engines and the public.

#3 Restrict Private Content Access to Member Only

This is a more advanced and complex method but comes in handy if you have a membership or e-commerce website in place. In this case, you will probably want to create a member only section where only your paid members or customers are allowed to access your private content and documents.

7 Ways to Protect WordPress PDF Files Ursus Minor

What you need to do is simply install and use a membership plugin. Ultimate Member stands out among all available WordPress membership plugins thanks to its simple logic and UI.  

How to restrict private content access to members using Ultimate Member:

  1. Install and activate Ultimate Member plugin under WordPress admin panel
  2. Create a new WordPress page/post
  3. At the bottom of the page, you’ll find “UM Content Restriction” section.
    Simply choose who can access this content.

Protect PDF Files Directly

Although your WordPress pages or posts are protected, all 3 methods above don’t really protect your uploaded PDF files. In other words, when you attach your PDF files to those protected pages and posts, they’re still accessible to the public. So in case people can somehow find the file URLs through search engines or sharing, they can just download and steal your PDF files.

This scenario happens often when your members who can access and download PDF files from “Member Only” page share them with their friends. These folks would then likely to share them with even more people especially when your content is great. As the result, more and more people will be able to access and download your private PDF documents even though they’re not a member of your website.

In order to resolve this problem, you have to not only protect your content but also block and restrict PDF file URL access directly so that unauthorized users won’t be able to access your PDF files, in any circumstances. Let’s take a look at the following solutions.

4. Protect PDF Files with Passwords

When you want to allow specific users to download PDF documents but still keep them private from the public, simply set a password to protect your PDF files. Simple Download Monitor plugin makes this entire complex process simple.

7 Ways to Protect WordPress PDF Files Ursus Minor

How to password protect PDF files:

  1. Download and install Simple Download Monitor plugin
  2. Click “Add new” under Downloads under your WordPress dashboard
  3. Enter the file details
  4. Upload the file you want to protect and insert them to page
  5. Edit Visibility in the right-hand menu form Publish to Password protected.
  6. Enter the password and click Publish
  7. Copy the Shortcode and manually insert it into a new or existing Page or Post. Alternatively, you can click SDM Download Button on your content editor to open SDM Downloads Insert Shortcode tab. Simply input “Download Title” and “Insert SDM Shortcode” once done.

Similar to the first method, the major disadvantage is you can only set one password per file.

5. Block Search Indexing and Restrict PDF file URL Access to Logged-in Users

What if your users reveal or share their passwords with others? There must be a better and more comprehensive way to protect your WordPress file uploads in general and PDF files in particular. And there comes Prevent Direct Access Gold. The plugin essentially blocks the PDF file URLs against the public and unwanted users. Those without permission will be redirected to the 404 error page if they try to access your WordPress PDF file uploads.

7 Ways to Protect WordPress PDF Files Ursus Minor

What’s more? Prevent Direct Access Gold prevents Google and other search engines from indexing your protected PDF files so that your private PDF files won’t be indexed nor appear on search results. This removes the probability that someone could possibly pick up your PDF file URL from a Google search.

How to block and restrict PDF file URL access to certain user roles:

  1. Download and install Prevent Direct Access Gold
  2. Upload the private PDF file that you want to protect into WordPress Media library.
  3. Tick “Protect this file” under Prevent Direct Access Gold tab (right-hand menu).

6. Expire PDF File URLs In Every 5 Seconds

Another way to protect your PDF files is to expire their URLs in a short amount of time say 5 seconds. This helps stop your members from downloading and sharing your PDF files with others. The file URL will likely expire by the time it’s shared.

We highly recommend “Private Magic Links” plugin as it works magically for both WordPress page/post and file URLs. Simply embed your file URL into your content as normal. The plugin will take care of the rest. First, it converts the original file URL into a private one, which is not indexed by Google, then expires the link in a preset time. After a period of time say 5 seconds, the plugin automatically creates a new one to replace the expired link and so on.

#7 Use a PDF Viewer to Embed & Protect PDF Files

Last but not least, you can use a WordPress PDF viewer plugin to embed your documents directly into website content. In other words, your subscribers and paid members have to go to your website to view the PDF files instead of just getting direct download links, which they can copy and then share them with others.

7 Ways to Protect WordPress PDF Files Ursus Minor

These PDF viewer plugins provide your visitors with a simple but elegant viewer, and at the same time, prevent them from sharing and downloading documents. For example, PDF Embedder, one of the most popular WordPress PDF viewer plugins with more than 100,000 active installs, enables you to embed your PDF files into virtually any WordPress pages or posts. Its premium version adds on a secure option that makes it much more difficult for users to download the original PDF document.

How to embed PDF file directly into content using PDF Embedder plugin:

  1. Download and install PDF Embedder plugin.
  2. Upload the PDF file that you want to protect into WordPress Media library
  3. Select and insert a PDF file into your page/post using “Add Media”. Once selected, a shortcode is generated by PDF Embedder that displays your chosen PDF file content directly on your WordPress page or post.

Wrapping Up

There are many ways to protect WordPress PDF files. You can either block these PDF file URLs directly or restrict access to WordPress post/page that contains these documents. There are 3 common ways to prevent direct access to your content, namely, password protecting, expiring and changing their URLs and restricting their access using a membership plugin. The main drawback of these methods is your attached PDF files are actually not protected. As a result, people could still access and share these private PDF documents.

The other and arguably better solution is to block direct file access to these PDF documents. You can protect your PDF file downloads through password with Download Monitor Plugin. Better yet, use Prevent Direct Access Gold plugin to protect your PDF files more comprehensively. It not only blocks direct access to your private PDF files but also blocks search indexing so that people won’t be able to find your PDF files on Google search results.

To conclude, it’s highly recommended that you use these 2 methods together for better security: restrict access to your content, and at the same time, protect your attached PDF files. You can use Ultimate Members to create a membership website and Prevent Direct Access Gold to protect your PDF files. Alternatively, if you don’t need a membership site, use Protect WordPress Pages & Posts plugin instead.

OceanWP - a free Multi-Purpose WordPress theme