{"title":"How to Password Protect Web Directories in | NameSilo Blog","description":"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.","url":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel","locale":"en","alternates":[{"locale":"en","url":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel"},{"locale":"x-default","url":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel"}],"properties":{"og:site_name":"NameSilo Blog","og:type":"article","og:title":"How to Password Protect Web Directories in | NameSilo Blog","og:description":"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.","og:url":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel","og:locale":"en_US","og:image":"https://www.namesilo.com/blog/api/media/8677e59dafa3f3031d28ff0f.png","og:image:secure_url":"https://www.namesilo.com/blog/api/media/8677e59dafa3f3031d28ff0f.png","og:image:alt":"Illustration of password protecting a web directory in cPanel using Directory Privacy and HTTP authentication to restrict access to private website folders.","article:published_time":"2026-09-02T04:48:34.343Z","article:modified_time":"2026-09-02T04:49:04.889Z","article:section":"Websites & Hosting","og:image:width":"1400","og:image:height":"400"},"names":{"description":"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.","robots":"index,follow,max-image-preview:large","twitter:card":"summary_large_image","twitter:title":"How to Password Protect Web Directories in | NameSilo Blog","twitter:description":"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.","twitter:image":"https://www.namesilo.com/blog/api/media/8677e59dafa3f3031d28ff0f.png","twitter:image:alt":"Illustration of password protecting a web directory in cPanel using Directory Privacy and HTTP authentication to restrict access to private website folders.","author":"NameSilo Staff"},"localeAlternates":[],"jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.namesilo.com/#organization","name":"NameSilo","url":"https://www.namesilo.com","logo":{"@type":"ImageObject","url":"https://www.namesilo.com/blog/assets/namesilo-CMhL34SY.svg","width":520.6,"height":128},"sameAs":["https://x.com/namesilo","https://www.linkedin.com/company/namesilo/","https://www.facebook.com/namesilo/","https://www.youtube.com/user/OfficialNameSilo"],"contactPoint":{"@type":"ContactPoint","contactType":"customer support","url":"https://www.namesilo.com/support/v2","telephone":"+1-888-462-6950","availableLanguage":"English","hoursAvailable":{"@type":"OpeningHoursSpecification","dayOfWeek":["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],"opens":"00:00","closes":"23:59"}}},{"@type":"WebSite","@id":"https://www.namesilo.com/blog#website","url":"https://www.namesilo.com/blog","name":"NameSilo Blog","publisher":{"@id":"https://www.namesilo.com/#organization"}},{"@type":"WebPage","@id":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel#webpage","url":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel","name":"How to Password Protect Web Directories in | NameSilo Blog","description":"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.","inLanguage":"en","isPartOf":{"@id":"https://www.namesilo.com/blog#website"},"breadcrumb":{"@id":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel#breadcrumb"},"primaryImageOfPage":{"@type":"ImageObject","url":"https://www.namesilo.com/blog/api/media/8677e59dafa3f3031d28ff0f.png","caption":"Illustration of password protecting a web directory in cPanel using Directory Privacy and HTTP authentication to restrict access to private website folders."},"mainEntity":{"@id":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel#article"}},{"@type":"BreadcrumbList","@id":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"NameSilo Blog","item":"https://www.namesilo.com/blog/en"},{"@type":"ListItem","position":2,"name":"How to Password Protect Web Directories in cPanel","item":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel"}]},{"@type":"BlogPosting","@id":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel#article","url":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel","headline":"How to Password Protect Web Directories in cPanel","description":"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.","inLanguage":"en","mainEntityOfPage":{"@id":"https://www.namesilo.com/blog/en/websites-hosting/how-to-password-protect-web-directories-in-cpanel#webpage"},"author":{"@type":"Organization","@id":"https://www.namesilo.com/blog/en/author/namesilo-staff#author","name":"NameSilo Staff","url":"https://www.namesilo.com/blog/en/author/namesilo-staff"},"publisher":{"@id":"https://www.namesilo.com/#organization"},"datePublished":"2026-09-02T04:48:34.343Z","dateModified":"2026-09-02T04:49:04.889Z","image":{"@type":"ImageObject","url":"https://www.namesilo.com/blog/api/media/8677e59dafa3f3031d28ff0f.png","caption":"Illustration of password protecting a web directory in cPanel using Directory Privacy and HTTP authentication to restrict access to private website folders.","width":1400,"height":400},"articleSection":["Websites & Hosting"],"timeRequired":"PT3M"}]},"jsonUrl":"https://www.namesilo.com/blog/llms.json?path=%2Fblog%2Fen%2Fwebsites-hosting%2Fhow-to-password-protect-web-directories-in-cpanel"}