Once a file is protected by Prevent Direct Access (PDA) Gold, its URL is actually changed as we move the file into our protected folder, i.e. _pda. So if you protect media files already embedded in your content, those images or documents (URL) will go missing.
What you can do is simply updating the unprotected with protected URLs manually in your content. That works if there are only a few protected files on your content. What if there are hundreds of these files?
That’s when our recently released settings option comes in useful.
If you haven’t embedded your files into content yet, you should:
- Protect these files first
- Embed them into content as normal
- The protected file URLs are updated for you automatically
- You don’t have to use the S&R feature at all
Once, the settings option is enabled, our PDA Gold will:
- Filter the content of your WordPress page or post after it’s retrieved from the database and before it’s displayed to the screen using the_content filter
- Search for all the
<a>tag in the content using regular expressions
- Once we have all the file URL of images and links embedded in the content, we will check if the URL exists in the database (DB):
- If it does, the file is not protected and we leave it as it is
- If it doesn’t, we insert the
_pdainto the URL and check again whether it exists in the DB. If it does – meaning the file is protected, we will update its file URL accordingly.
By using WordPress
the_content filter, our Gold version will do the URL replacement automatically for you. In other words, you don’t have to manually update the protected file URL in your content anymore. This method is arguably better than replacing the actual file URLs in the DB which require you to do the reverse process when unprotecting the files.
Performance-wise, it’s recommended to select only pages you want our plugin to filter and replace unprotected URLs in your content.
|Using the_content filter||Replacing the actual file URL in the DB|
|Process||Run and update the file URL dynamically on page load||Run a heavy SQL searching, checking and replacing the file URL of all your attachment files|
|Frequency||On every page load||Once|
|Effectiveness||Run on selected pages only||Have to search and replace the file URL again once the file is unprotected|
This is also how our magic links work as well.
- If there are only a few unprotected file URLs in your content, just manually update them with the protected ones
- If there are hundreds of them, enable our settings option above and select which page(s) our PDA Gold should find and change file URLs automatically for you