Securing web directories from .htaccess passwords is the best way to protect on Apache server because it uses encoded passwords and it has different encoded codes for the same passwords which saves on another hidden file. Other features like adding and selecting IPs to access create more protected directories.
To enable .htaccess password follow the next simple steps:
Generate your username and password from here.
Then copy the encoded username and password to a new file .htpasswd and save it in any folder before public_html in your cpanel.
Use .htaccess to include .htpasswd with full web directory url by copying this code to .htaccess:
AuthName “Restricted Area”
After the whole process clear your browser cache and check it by accessing the directory!