{"id":18426,"date":"2026-09-30T07:33:59","date_gmt":"2026-09-30T04:33:59","guid":{"rendered":"https:\/\/www.hyyat.com\/knowledgebase\/password-protect-directory-cpanel\/"},"modified":"2026-11-22T13:55:29","modified_gmt":"2026-11-22T10:55:29","password":"","slug":"password-protect-directory-cpanel","status":"publish","type":"docs","link":"https:\/\/www.hyyat.com\/en\/knowledgebase\/password-protect-directory-cpanel\/","title":{"rendered":"Password Protect a Folder in cPanel (Directory Privacy): Steps, and What It Does and Does Not Protect"},"content":{"rendered":"<div class=\"hkb\" dir=\"ltr\">\n<div class=\"hkb-tldr\"><b>The idea in two lines<\/b><b>Directory Privacy<\/b> makes the browser ask for a username and password before a folder opens. Click <b>Edit<\/b> next to the folder, tick <b>Password protect this directory<\/b>, enter a name and click <b>Save<\/b>, then create a user with a password.<\/div>\n<div class=\"hy-vid\"><div style=\"width: 1280px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-18426-1\" width=\"1280\" height=\"720\" poster=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-cpanel-privacy-en.jpg\" preload=\"none\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-cpanel-privacy-en.mp4?_=1\" \/><a href=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-cpanel-privacy-en.mp4\">https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hyyat-cpanel-privacy-en.mp4<\/a><\/video><\/div><\/div>\n<p>You have a staging copy of your site that visitors should not see, or a folder of files meant for clients only. Directory Privacy puts a simple lock on the folder: anyone who opens it gets a small browser prompt asking for login details, and without them they see nothing.<\/p>\n<h2>Stage one: choose the folder<\/h2>\n<ol class=\"hkb-steps\">\n<li><b>Open Directory Privacy<\/b> in the Files section of cPanel.<\/li>\n<li><b>Navigate to the folder<\/b> click a folder name or icon to go inside it.<\/li>\n<li><b>Click Edit<\/b> next to the folder you want to protect.<\/li>\n<\/ol>\n<figure class=\"hkb-fig\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hkb-fd-en-f-priv.webp\" alt=\"The folder list in cPanel Directory Privacy\" width=\"800\" height=\"451\" loading=\"lazy\" \/><\/figure>\n<h2>Stage two: turn protection on<\/h2>\n<ol class=\"hkb-steps\">\n<li><b>Tick Password protect this directory<\/b> on the Security Settings page.<\/li>\n<li><b>Enter a name for the protected directory<\/b> visitors see it in the password prompt, such as Client Area.<\/li>\n<li><b>Click Save<\/b> then Back to reach the user section.<\/li>\n<\/ol>\n<figure class=\"hkb-fig\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.hyyat.com\/zasogooh\/2026\/11\/hkb-fd-en-f-privedit.webp\" alt=\"The page for turning on folder password protection in cPanel\" width=\"800\" height=\"451\" loading=\"lazy\" \/><\/figure>\n<h2>Stage three: create a user<\/h2>\n<p>Protection on its own locks everyone out. Create at least one user with a name and password. You can add several users to the same folder and remove any of them later without turning protection off.<\/p>\n<h2>What this protection suits<\/h2>\n<div class=\"hkb-tbl\">\n<table>\n<thead>\n<tr>\n<th>Good for<\/th>\n<th>Not good for<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>A staging site or a site under construction<\/td>\n<td>A customer login system with many accounts<\/td>\n<\/tr>\n<tr>\n<td>A private downloads folder for your team<\/td>\n<td>Protecting a single page inside WordPress<\/td>\n<\/tr>\n<tr>\n<td>An extra layer on an admin folder<\/td>\n<td>A replacement for updates and strong passwords<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"hkb-note warn\"><b>Before you protect wp-admin:<\/b> some plugins use files inside it for visitors, such as <code>admin-ajax.php<\/code>, so parts of your site may break. Test on a staging site first.<\/div>\n<h2>Removing protection<\/h2>\n<p>Go back to the same folder, click Edit, untick protection and click Save. The tool writes its settings into the folder&#8217;s <code>.htaccess<\/code> file, so do not delete that file by hand or the protection disappears.<\/p>\n<h2>Frequently asked questions<\/h2>\n<div class=\"hkb-faq\">\n<details>\n<summary>Does protection cover subfolders?<\/summary>\n<p>Yes, everything inside the protected folder needs the password.<\/p>\n<\/details>\n<details>\n<summary>I forgot the folder password. What now?<\/summary>\n<p>Open Directory Privacy and change the user&#8217;s password, or create a new user.<\/p>\n<\/details>\n<details>\n<summary>Does it protect against hacking?<\/summary>\n<p>It stops ordinary browsing only and does not replace updates and strong passwords.<\/p>\n<\/details>\n<details>\n<summary>Will it affect my Google ranking?<\/summary>\n<p>A protected folder is not indexed, which is usually what you want for a staging site.<\/p>\n<\/details>\n<\/div>\n<div class=\"hkb-rel\"><b>Related guides<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/disable-directory-listing-cpanel\/\">How to Stop Your Website Files Being Listed in the Browser (cPanel Indexes)<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/create-ftp-account-cpanel\/\">Create an FTP Account in cPanel for a Developer or Staff Member, Limited to One Folder<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/how-to-use-file-manager-in-cpanel\/\">cPanel File Manager: Open It, Show Hidden Files, Change Permissions and More<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/exposed-sensitive-files-env-git-backups\/\">Exposed Sensitive Files on Your Site: .env, .git and Backups, and How to Hide Them<\/a><\/li>\n<li><a href=\"https:\/\/www.hyyat.com\/en\/knowledgebase\/cpanel-files-databases-section\/\">The Files and Databases Sections in cPanel: File Manager, FTP and Creating a Database<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.hyyat.com\/en\/kb\/website-control-panel-cpanel\/\">All cPanel guides \u2192<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The idea in two linesDirectory Privacy makes the browser ask for a username and password before a folder opens. Click Edit next to the folder, tick Password protect this directory, enter a name and click Save, then create a user with a password. You have a staging copy of your site that visitors should not [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":20785,"comment_status":"open","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"_templately_pack_id":"","_templately_imported_at":"","_templately_source":"","_templately_import_session_id":"","footnotes":""},"doc_category":[2749],"doc_tag":[],"class_list":["post-18426","docs","type-docs","status-publish","has-post-thumbnail","hentry","doc_category-website-control-panel-cpanel"],"year_month":"2026-11","word_count":487,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"ahmed fathy","author_nicename":"ahmed-fathy","author_url":"https:\/\/www.hyyat.com\/en\/author\/ahmed-fathy\/"},"doc_category_info":[{"term_name":"cPanel Guides","term_url":"https:\/\/www.hyyat.com\/en\/kb\/website-control-panel-cpanel\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/18426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/comments?post=18426"}],"version-history":[{"count":0,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/docs\/18426\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/media\/20785"}],"wp:attachment":[{"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/media?parent=18426"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_category?post=18426"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hyyat.com\/en\/wp-json\/wp\/v2\/doc_tag?post=18426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}