Directory IP Restrictor
Restrict access to specific folders/pages by username + IP whitelist (with optional child-path restriction).
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/matrosovdream/directory-ip-restrictor/archive/refs/heads/main.zip🧱 Directory IP Restrictor (WordPress Plugin)
Directory IP Restrictor is a lightweight WordPress plugin that lets you restrict access to specific folders or pages based on user roles and IP addresses.
🚀 Features
- Restrict access to any folder or page path
- Option to include child paths
- Flexible role-based and IP-based access control
- Simple, self-contained admin settings page
- “Active” toggle per rule
- Multi-group support (“Allow extra groups”)
- Works with both IPv4 and IPv6
🛠️ Installation
- Download the plugin ZIP or clone this repository:
git clone https://github.com/Matrosovdream/directory-ip-restrictor.git - Copy the folder
directory-ip-restrictor/into your WordPresswp-content/plugins/directory. - Activate it from WordPress Admin → Plugins → Directory IP Restrictor.
- Go to Settings → Directory IP Restrictor and create your rules.
⚙️ Configuration
Each rule includes:
- Folder or page: Example:
/privateor/wp-content/uploads/secure - Restrict children: Apply rule to all sub-paths
- Active: Enable/disable rule
- Allowed user groups: Select WordPress roles that can access
- Allow extra groups: Custom user/IP lists (newline-separated IPs)
Access is granted if:
- The user has any selected role OR
- The visitor’s IP matches one of the allowed IPs
🧩 Technical Notes
- Rules are stored in the WordPress options table (
dir_ipr_settings). - Uses early
template_redirecthook to block or allow. - For protecting static assets (e.g.,
/uploads/formidable), optional.htaccessor Nginx rewrites can route requests through WordPress.
📄 License
Released under the MIT License.
🧑💻 Author
Developed by Stanislav Matrosov
GitHub: @Matrosovdream