{"id":218,"date":"2016-05-02T02:14:15","date_gmt":"2016-05-02T02:14:15","guid":{"rendered":"http:\/\/www.copahost.com\/blog\/?p=218"},"modified":"2020-05-31T14:28:18","modified_gmt":"2020-05-31T14:28:18","slug":"password-protect-folder-site-htaccess","status":"publish","type":"post","link":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/","title":{"rendered":"How to password protect a folder in your site"},"content":{"rendered":"<p>This tutorial shows how to password protect a folder\u00a0in your site, using cPanel. This is also known as htaccess or htpasswd folder protection. This allows you to create a restricted area, where your visitors will have to type a login and password to gain access. This guide is based in a <a href=\"https:\/\/www.copahost.com\/en\/web-hosting\">cheap web hosting cPanel<\/a> account from Copahost.<\/p>\n<p>In this example, we created a sample folder called <strong>restricted-area <\/strong>inside public_html, and we will protect it with a login and password. We wish to have this URL protected:<strong> http:\/\/www.siteexemplo.com\/restricted-area<\/strong> . This will be our password protect folder.<\/p>\n<p>First of all, we have to open cPanel, and click in <strong>Directory Privacy<\/strong>, which is located under the Files tab.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-219\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-1.jpg\" alt=\"password protect directory 1\" width=\"900\" height=\"430\" \/><\/p>\n<p>Now we have to find the folder we wish to protect. Our example folder is \/public_html\/restricted-area . To enter in the public_html folder, we will click exactly in the yellow folder icon, as marked in red. Warning: if you click in the text &#8220;public_html&#8221;, cPanel will understand you wish to this to be a password protected folder. To avoid this issue, we have to click in the yellow icon as shown.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-220 size-full\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg\" alt=\"password protect directory 2\" width=\"453\" height=\"503\" \/><\/p>\n<h3>Choosing the place of the\u00a0password protected folder<\/h3>\n<p>Now we are inside the folder \/public_html . We must click over the text of the folder we wish to protect (restricted-area).<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-221 size-full\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-3.jpg\" alt=\"password protect a folder 3\" width=\"809\" height=\"489\" \/><\/p>\n<p>Now we have to <strong>check (activate)<\/strong> the option <strong>Password protect this directory<\/strong>, and then, enter a name for the restricted area. You must click <strong>Save<\/strong> afterwards.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-222\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-4.jpg\" alt=\"choosing the place to password protect folder\" width=\"900\" height=\"267\" \/><\/p>\n<p>After placing this configuration, we have to choose an <strong>username<\/strong> and <strong>password<\/strong>. More than one user and passwords can be added. After that, we must click <strong>Save<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-223 size-full\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-5.jpg\" alt=\"password protect directory 5\" width=\"849\" height=\"371\" \/><\/p>\n<p>You will see this <strong>success<\/strong> message. \u00a0Now just click<strong> Go back<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-226 size-full\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-9.jpg\" alt=\"password protect folder sucess\" width=\"521\" height=\"331\" \/><\/p>\n<h3>Testing the restricted area, protected by password<\/h3>\n<p>The job to password protect a folder is now complete! Now you can\u00a0open your browser and type<strong> http:\/\/www.siteexemplo.com\/restricted-area<\/strong><\/p>\n<p>In this example, the htaccess protected folder is <strong>restricted-area<\/strong>.<\/p>\n<p>By entering the username created (john) and its password, you will have access to this content.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-224\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-7.jpg\" alt=\"password protect directory 7\" width=\"900\" height=\"320\" \/><\/p>\n<h3>Add or remove users from htpasswd<\/h3>\n<p>In <a href=\"https:\/\/www.copahost.com\/blog\/manage-email-lists-cpanel-mailman\/\" >cPanel you can manage<\/a>, delete or add more than one user, as shown:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-225 size-full\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-8.jpg\" alt=\"password protect directory 8\" width=\"669\" height=\"313\" \/><\/p>\n<h3>This video explains in details the whole process of protecting folders with htaccess using cPanel<\/h3>\n<p><iframe title=\"How to protect a folder with htaccess password (using cPanel)\" width=\"800\" height=\"600\" src=\"https:\/\/www.youtube.com\/embed\/IxgM45XGvA0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to password protect a folder\u00a0in your site, using cPanel. This is also known as htaccess or htpasswd folder protection. This allows you to create a restricted area, where your visitors will have to type a login and password to gain access. This guide is based in a cheap web hosting cPanel [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":220,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,63],"tags":[64,65,66,67],"class_list":["post-218","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpanel","category-security","tag-htaccess","tag-htpasswd","tag-password-protect-folder","tag-restricted-area"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to password protect a folder in your site - Copahost<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to password protect a folder in your site - Copahost\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows how to password protect a folder\u00a0in your site, using cPanel. This is also known as htaccess or htpasswd folder protection. This allows you to create a restricted area, where your visitors will have to type a login and password to gain access. This guide is based in a cheap web hosting cPanel [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/\" \/>\n<meta property=\"og:site_name\" content=\"Copahost\" \/>\n<meta property=\"article:published_time\" content=\"2016-05-02T02:14:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-05-31T14:28:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"453\" \/>\n\t<meta property=\"og:image:height\" content=\"503\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Gustavo Gallas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gustavo Gallas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/\"},\"author\":{\"name\":\"Gustavo Gallas\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246\"},\"headline\":\"How to password protect a folder in your site\",\"datePublished\":\"2016-05-02T02:14:15+00:00\",\"dateModified\":\"2020-05-31T14:28:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/\"},\"wordCount\":398,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg\",\"keywords\":[\"htaccess\",\"htpasswd\",\"password protect folder\",\"restricted area\"],\"articleSection\":[\"cPanel\",\"Security\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/\",\"url\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/\",\"name\":\"How to password protect a folder in your site - Copahost\",\"isPartOf\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg\",\"datePublished\":\"2016-05-02T02:14:15+00:00\",\"dateModified\":\"2020-05-31T14:28:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#primaryimage\",\"url\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg\",\"contentUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg\",\"width\":453,\"height\":503},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.copahost.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to password protect a folder in your site\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#website\",\"url\":\"https:\/\/www.copahost.com\/blog\/\",\"name\":\"Copahost\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.copahost.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\",\"name\":\"Copahost\",\"url\":\"https:\/\/www.copahost.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png\",\"contentUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png\",\"width\":223,\"height\":40,\"caption\":\"Copahost\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246\",\"name\":\"Gustavo Gallas\",\"description\":\"Graduated in Computing at PUC-Rio, Brazil. Specialized in IT, networking, systems administration and human and organizational development\u200b. Also have brewing skills.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/gustavo-gallas-107926196\/\"],\"url\":\"https:\/\/www.copahost.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to password protect a folder in your site - Copahost","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/","og_locale":"en_US","og_type":"article","og_title":"How to password protect a folder in your site - Copahost","og_description":"This tutorial shows how to password protect a folder\u00a0in your site, using cPanel. This is also known as htaccess or htpasswd folder protection. This allows you to create a restricted area, where your visitors will have to type a login and password to gain access. This guide is based in a cheap web hosting cPanel [&hellip;]","og_url":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/","og_site_name":"Copahost","article_published_time":"2016-05-02T02:14:15+00:00","article_modified_time":"2020-05-31T14:28:18+00:00","og_image":[{"width":453,"height":503,"url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg","type":"image\/jpeg"}],"author":"Gustavo Gallas","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Gustavo Gallas","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#article","isPartOf":{"@id":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/"},"author":{"name":"Gustavo Gallas","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246"},"headline":"How to password protect a folder in your site","datePublished":"2016-05-02T02:14:15+00:00","dateModified":"2020-05-31T14:28:18+00:00","mainEntityOfPage":{"@id":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/"},"wordCount":398,"commentCount":0,"publisher":{"@id":"https:\/\/www.copahost.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#primaryimage"},"thumbnailUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg","keywords":["htaccess","htpasswd","password protect folder","restricted area"],"articleSection":["cPanel","Security"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/","url":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/","name":"How to password protect a folder in your site - Copahost","isPartOf":{"@id":"https:\/\/www.copahost.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#primaryimage"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#primaryimage"},"thumbnailUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg","datePublished":"2016-05-02T02:14:15+00:00","dateModified":"2020-05-31T14:28:18+00:00","breadcrumb":{"@id":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#primaryimage","url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg","contentUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/password-protect-directory-2.jpg","width":453,"height":503},{"@type":"BreadcrumbList","@id":"https:\/\/www.copahost.com\/blog\/password-protect-folder-site-htaccess\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.copahost.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to password protect a folder in your site"}]},{"@type":"WebSite","@id":"https:\/\/www.copahost.com\/blog\/#website","url":"https:\/\/www.copahost.com\/blog\/","name":"Copahost","description":"","publisher":{"@id":"https:\/\/www.copahost.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.copahost.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.copahost.com\/blog\/#organization","name":"Copahost","url":"https:\/\/www.copahost.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png","contentUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png","width":223,"height":40,"caption":"Copahost"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246","name":"Gustavo Gallas","description":"Graduated in Computing at PUC-Rio, Brazil. Specialized in IT, networking, systems administration and human and organizational development\u200b. Also have brewing skills.","sameAs":["https:\/\/www.linkedin.com\/in\/gustavo-gallas-107926196\/"],"url":"https:\/\/www.copahost.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/comments?post=218"}],"version-history":[{"count":6,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/218\/revisions"}],"predecessor-version":[{"id":2570,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/218\/revisions\/2570"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/media\/220"}],"wp:attachment":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/media?parent=218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/categories?post=218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/tags?post=218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}