Restricting access.
WHAT IT DOES
Requires a username and password before anything in a directory can be accessed.
Applied at the server level, before your application runs.
WHEN TO USE IT
Staging sites, so they are neither public nor indexed Development areas Any directory that must exist but should not be public
HOW
cPanel Directory Privacy. Select the directory, enable protection, create a user.
WHY IT IS BETTER THAN OTHER METHODS
It prevents access entirely, rather than relying on a setting being respected.
For a staging site, that also keeps it out of search results reliably.
WHAT TO BE CAREFUL WITH
Protecting a directory your application needs to access Protecting public_html by accident
FOR STAGING SITES
Protect it before you put anything in it.
A staging site indexed by search engines competes with your live site.
WHAT IT DOES NOT PROTECT
Files whose direct URL is known, if they are outside the protected directory.
TO REMOVE IT
The same screen. Disable protection.