cPanel includes simple protection tools you can use without any code. Here are three of the most useful.
1. Password-protect a folder (Directory Privacy)
Use this for a private area, a staging copy or files for clients only.
- Open Directory Privacy in the Files section and click the folder, then Edit.
- Tick Password protect this directory and type a label, then click Save.
- Create a user: type a Username and Password, then Save.
Visitors now see a login box. Subfolders are protected too. Remember that this protects web access only. FTP and other access are not covered. If saving fails, check the folder permission with File Manager.
2. Block an IP address (IP Blocker)
Use it to stop an address that keeps attacking or scraping your site.
- Open IP Blocker in the Security section.
- Type an IP Address or Domain and click Add.
You can enter a single address, a range, or a CIDR block. To unblock, click Delete then Remove IP. This blocks access to your website only, not webmail. Be careful not to block your own address, and remember many home connections change address.
3. Stop hotlinking (Hotlink Protection)
Hotlinking is when another site shows your images directly from your server, using your bandwidth.
- Open Hotlink Protection in the Security section and click Enable.
- Check the list under URLs to allow access. It must include your own site, with and without www.
- In Block direct access for the following extensions, list file types such as jpg, png and gif.
- Optionally enter a URL to redirect blocked requests to, then click Submit.
Disabling it deletes the allowed list, so save the list first.
Go further
For stronger protection, read how to secure your cPanel website and how to turn on two-factor authentication.

