
How to Password Protect Web Directories in cPanel
Use cPanel's Directory Privacy (Files section) to add HTTP Basic Authentication to any folder via .htaccess and .htpasswd. Never protect public_html itself. If protecting /wp-admin/, whitelist admin-ajax.php, though some AJAX calls may still intermittently break; consider protecting a narrower subdirectory instead.









