| 开发者 | birimone |
|---|---|
| 更新时间 | 2026年11月18日 17:23 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
/wp-content/uploads/, and every file there is a public URL. Making a page private, or putting your site behind a login, does not protect the files on it: anyone with the link can open them.
Birim Private Files routes every request for an uploaded file through WordPress and only serves it to people who are allowed to see it.
[birim_my_files] on a page and each person sees the files they uploaded or that were shared with them.wp-content/uploads/.htaccess automatically, and removed when you deactivate the plugin.public/*.birim_private_files_can_access filter: ( bool $allowed, string $relative_path ) to make your own access decisions, for example per file or per user.birim_private_files_served action: ( string $relative_path, string $absolute_path ), fired just before an allowed file is sent, for example to log downloads.birim_private_files_serve( $path, array( 'download' => true ) ) sends a file as a download (attachment) instead of inline.birim-private-files folder to /wp-content/plugins/.Activate the plugin, go to Settings > Private Files, tick "Make uploaded files private" and choose who may open files: logged-in users, chosen roles, or only the people each file is shared with. A PDF link then opens only for those people: logged-out visitors are sent to the login page, and logged-in people without access get an error. The status line confirms that direct links are blocked on your server (on nginx, after you add the rule shown).
Yes, for logged-out visitors, unless the files match a public exception. This plugin is meant for sites where the content is private too. Use the public exceptions for files that must stay visible, such as a logo.
Your web server is serving files directly without asking WordPress. On nginx, add the rule shown on the settings page. On Apache, your host may not allow .htaccess rewrite rules, or it may run nginx in front of Apache; send your host the rule shown on the settings page.
Your server could not make a request to its own website, which some hosts block. Check manually: copy the link of an uploaded file, open a private browser window and paste it. You should see the login page or "This file is private".
Each file request now starts WordPress to check the login, so files are served a little slower than directly by the web server. Logged-in browsers cache files for an hour.
Files are sent with Cache-Control: private, which CDNs respect by default. If your CDN is set to cache everything regardless of headers, exclude /wp-content/uploads/ from that rule.
On Apache the rules are removed and files are public again. On nginx, remove the rule you added, or file links will stop working.
Not yet. Multisite support is planned.
Please email security@birim.one instead of posting in the forum. See https://birimone.pages.dev/security/ for the full policy.