Resonanz Secure Downloads

By Resonanz Digital

0+ active installationsVersion 1.6.0

This plugin allows users to mark a file in the Media Library for secure download. You can specify which user roles should have access to the file.

Description

This WordPress plugin allows users to mark a file in the Media Library for secure download.
If protection is toggled on, you can specify which user roles should have access to the file.

Note that the user role guest is used by this plugin to represent users who are not logged in.
This role is not a default WordPress role and created on-the-fly by the plugin.

Features

  • A simple checkbox allows you to toggle protection on or off for any (non-image) file.
  • When toggled on, you can specify which user roles can download the file. Admins always have access.
  • If a user is not allowed to download a file, you can optionally redirect them to a different page.
  • The plugin provides an overview of all protected files in a sortable table.

Important note

The plugin works by (re)writing .htaccess to allow or disallow access to the specified file(s).
Please make sure that the server is configured to allow modification of the .htaccess file!
The plugin will also add new rewrite rules to WordPress and use the URL /secure-download/ to serve files.
Servers that ignore .htaccess, such as nginx, need equivalent rules in their own configuration. Without them, files are not protected.

Only files in the Media Library are served through /secure-download/. Other files of a protected type return a 404 for everyone except administrators.
While PDF is a protected file type, WordPress no longer creates preview images for newly uploaded PDFs. Previews of existing PDFs are not removed.

Developed and maintained by Resonanz Digital, a web agency in Vienna building WordPress sites and custom web applications.

Instructions

  1. Install the plugin via the WordPress plugin repository or by uploading the plugin files to your server.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Go to the Media Library and select a file you want to protect.
  4. In the file’s attachment details, towards the bottom of the page, you will see a section titled “Protect this file?”, with a checkbox “Enable protection”.
  5. Check the box to enable protection for the file.
  6. Below the checkbox, you can select which user roles should have access to the file. Admins always have access.

You can manage the settings for the plugin by selecting “Resonanz Secure Downloads” in the sidebar menu.
You can select which file extensions should be protected. You can also specify a redirect page for users who are not allowed to download the file.
If a user lacks permission to download a file, they will be redirected to the specified page.

On the page “Protected Files”, you can see an overview of all files that are protected by the plugin.
This allows you to easily manage and review the files that have been marked for secure download.

FAQ

The plugin does not work, what should I do?

The most important thing to check is whether the server is configured to allow modification of the .htaccess file.
If the plugin is unable to write to the .htaccess file, it will not be able to protect files.

Does this plugin work with other plugins related to pages and posts?

We believe that the plugin should work correctly on most WordPress websites regardless of which plugins are installed.
However, there are no guarantees. If you do encounter issues, please let us know.

Where can I find further help?

If you require assistance or experience technical problem, feel free to contact us

Changelog

1.6.0

Release Date 29th October 2026

  • Admin screens reworked in the look of Resonanz API Sync: white cards, a page header with version and links, notes as callouts, the file extensions as a grid, and an “Unsaved changes” hint next to the Save button.
  • Protected Files: the table sits in a card with a file count, allowed roles show as badges with their names, and the empty state explains the first steps.

1.5.0

Release Date 21st October 2026

  • Security: fixed a bypass that served protected files when the URL contained “./” or “//”.
  • Security: fixed a bypass that served protected files directly when the URL carried a resonanz_file_url parameter. Existing .htaccess rules are rewritten automatically.
  • Security: /secure-download/ now only serves protected file types from the Media Library. It no longer serves other files from the uploads folder, including folders other plugins lock.
  • Security: downloads are sent with Cache-Control: private, no-store, so CDNs and proxies cannot cache protected files.
  • Security: PDF preview images are no longer created while PDF is a protected file type, because they showed the first page publicly.
  • Security: the AJAX page link lookup now requires the manage_options capability and has a prefixed action name.
  • Fixed a fatal error under WP-CLI and on servers where the document root is not the WordPress root.
  • Fixed the first save of the settings not writing the .htaccess rules.
  • Fixed users being sent to the wrong page, or a blank page, when no redirect page was selected.
  • Fixed paging on the Protected Files overview failing with “Security check failed”.
  • Saved settings are now validated against the list of supported extensions.
  • The settings page warns when the server does not appear to be Apache.

1.4.3

Release Date 16th June 2026

  • Verified that the plugin works under WordPress 7.0.

1.4.2

Release Date 17th December 2025

  • Verified that the plugin works under WordPress 6.9.

1.4.1

Release Date 2nd December 2025

  • Verified that the plugin works under WordPress 6.8.3.

1.4.0

Release Date 15th October 2025

  • Major performance improvements: removed flush_rewrite_rules() from init hook to avoid overhead on every page load
  • Implemented chunked file serving for efficient handling of large files without memory issues
  • Added static caching for plugin settings to reduce database queries
  • Optimized media library filter queries for better performance with multiple user roles
  • Replaced filemtime() calls with plugin version constant for faster asset loading
  • Enhanced path traversal security with null byte checks and realpath validation
  • Added transient caching (5 minutes) for protected files overview page with automatic cache invalidation
  • Optimized .htaccess updates to skip unnecessary file operations when extensions haven’t changed
  • Improved cache key uniqueness using cache groups to prevent conflicts with other plugins
  • Improved formatting of settings on Media detail pages and embedded modal on page edit
  • Fixed duplicate code execution in file permission checking

1.3.2

Release Date 4th June 2025

  • Upon plugin activation, we display a helpful notice to inform users about how to get started with the plugin.
  • Added links to the plugin’s settings page and the overview of protected files in the admin menu.
  • Added instructions on how to secure files on the overview of protected files when no files are protected yet.
  • Make sure that the new options are properly deleted when the plugin is uninstalled.
  • Improved instructions for the end user on how to use the plugin in this readme file.

1.3.1

Release Date 8th April 2025

  • Made several smaller fixes to ensure the plugin complies with WordPress coding standards.

1.3.0

Release Date 11th March 2025

  • Ensure that settings are properly sanitized upon saving.

1.2.3

Release Date 25th November 2024

  • Rewrote the file access check to make sure it also works correctly on Linux systems.
  • Enabled caching for direct database searches to improve performance of the plugin.
  • Refactored the code in places to make it a little leaner.

1.2.2

Release Date 30th October 2024

  • Made various improvements and fixes to ensure that the plugin conforms to WordPress coding standards.

1.2.1

Release Date 3rd September 2024

  • Fixed persistent bug that would prevent files from being served correctly.

1.2.0

Release Date 26th June 2024

  • Added the .htaccess rewrite rules back and merged it with the WordPress URL rewrite approach.
  • Added the possibility for the user to define which file extensions should be protected.
  • Added a link to the selected redirect page with AJAX so the user can quickly verify this is correct.

1.1.1

Release Date 24th June 2024

  • Added a page that gives an overview of all protected files in a sortable table.

1.1.0

Release date 20th June 2024-06-20

  • Downloading a file is now routed through a permalink to make it more secure: it hides the file’s URL.
  • The .htaccess-based rewrite has been replaced by the WordPress URL rewrite system.
  • Activating/deactivating the plugin will now flush the rewrite rules to ensure the new permalink is recognized.
  • Added a settings page where a user can specify to which page a user will be redirected if blocked.
  • Added an uninstall.php file to clean the database when the plugin is completely removed.

1.0.5

Release Date 4th June 2024

  • Fixed an issue where deactivating the plugin didn’t clean up the .htaccess file as intended.

1.0.4

Release Date 3rd June 2024

  • Fixed an issue where the plugin wouldn’t recognize that a file was an attachment with permissions.

1.0.3

Release Date 19th March 2024

  • Cleared output buffering before fetching file just to be safe.

1.0.2

Release Date 20th February 2024

  • Fixed an issue where downloading a files without attachment meta data would lead to a 404 error.