Sometimes you want to limit access to a website or a specific folder — for example, a staging site, a development area, or a private admin panel. A simple method is to restrict access by IP address using .htaccess.
.htaccess rules are supported.Create or edit .htaccess inside your website root folder (usually httpdocs).
<RequireAll>
Require all denied
Require ip 203.0.113.10
</RequireAll>
<RequireAll>
Require all denied
Require ip 203.0.113.10
Require ip 198.51.100.25
Require ip 192.0.2.0/24
</RequireAll>
If you want to protect only a specific path (for example /staging/), place the .htaccess file inside that folder.
Require all granted
Require not ip 203.0.113.10
If your domain is behind Cloudflare proxy, the server can see Cloudflare IPs instead of visitor IPs. In that case, IP allowlisting may not behave as expected. Use Cloudflare Firewall/Access rules, or disable proxy for testing.
If you accidentally block yourself, remove the rules from .htaccess using Plesk File Manager or FTP‑SSL.