{"id":151,"date":"2014-06-27T15:58:08","date_gmt":"2014-06-27T20:58:08","guid":{"rendered":"http:\/\/etapien.com\/guides\/?p=151"},"modified":"2020-08-24T14:22:21","modified_gmt":"2020-08-24T19:22:21","slug":"password-protect-directory-htaccess","status":"publish","type":"post","link":"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/","title":{"rendered":"How to password protect a directory with .htaccess"},"content":{"rendered":"<p style=\"color: #000000;\">To protect a directory on the web follow these simple steps:<\/p>\n<p style=\"color: #000000;\">1. Open a .htaccess file within the directory you wish to protect<\/p>\n<ol id=\"EnlighterJS_hwxzb654\" class=\"standardEnlighterJS EnlighterJSRendered\" style=\"color: #939393;\">\n<li class=\"firstline lastline odd hover\"><span class=\"unknown\" style=\"color: #000000;\">vim .htaccess<\/span><\/li>\n<\/ol>\n<p style=\"color: #000000;\">2. Insert the followoing code:<\/p>\n<ol id=\"EnlighterJS_hwxzb655\" class=\"standardEnlighterJS EnlighterJSRendered\" style=\"color: #939393;\">\n<li class=\"firstline odd hover\"><span class=\"unknown\" style=\"color: #000000;\">AuthUserFile \/route\/to\/directory\/.htpasswd<\/span><\/li>\n<li class=\"even hover\"><span class=\"unknown\" style=\"color: #000000;\">AuthGroupFile \/dev\/null<\/span><\/li>\n<li class=\"odd hover\"><span class=\"unknown\" style=\"color: #000000;\">AuthName &#8220;Custom text to show in pop-up&#8221;<\/span><\/li>\n<li class=\"even hover\"><span class=\"unknown\" style=\"color: #000000;\">AuthType Basic<\/span><\/li>\n<li class=\"odd hover\"><span class=\"kw1\" style=\"color: #1b609a;\">&lt;Limit<\/span><span class=\"unknown\" style=\"color: #000000;\"> GET<\/span><span class=\"kw1\" style=\"color: #1b609a;\">&gt;<\/span><\/li>\n<li class=\"even hover\"><span class=\"unknown\" style=\"color: #000000;\">require valid-user<\/span><\/li>\n<li class=\"lastline odd hover\"><span class=\"kw1\" style=\"color: #1b609a;\">&lt;\/Limit&gt;<\/span><\/li>\n<\/ol>\n<p style=\"color: #000000;\">3. Now we need to create the username and password:<\/p>\n<ol id=\"EnlighterJS_hwxzb656\" class=\"standardEnlighterJS EnlighterJSRendered\" style=\"color: #939393;\">\n<li class=\"firstline lastline odd hover\"><span class=\"unknown\" style=\"color: #000000;\"> htpasswd -c \/route\/to\/directory\/.htpasswd username<\/span><\/li>\n<\/ol>\n<p style=\"color: #000000;\">4. You should be prompted for a password.<\/p>\n<p style=\"color: #000000;\">5. Browse to the directory in your browser and you should be prompted for your username and password.<\/p>\n<p style=\"color: #000000;\">\n<p style=\"color: #000000;\">That&#8217;s it, make sure to actually change the &#8220;\/route\/to\/directory&#8221; to an existing directory.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To protect a directory on the web follow these simple steps: 1. Open a .htaccess file within the directory you wish to protect vim .htaccess 2. Insert the followoing code: AuthUserFile \/route\/to\/directory\/.htpasswd AuthGroupFile \/dev\/null AuthName &#8220;Custom text to show in pop-up&#8221; AuthType Basic &lt;Limit GET&gt; require valid-user &lt;\/Limit&gt; 3. Now we need to create the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to password protect a directory with .htaccess<\/title>\n<meta name=\"description\" content=\"password protect directory in apache, .htaccess\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/etapien.com\/guides\/password-protect-directory-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 directory with .htaccess\" \/>\n<meta property=\"og:description\" content=\"password protect directory in apache, .htaccess\" \/>\n<meta property=\"og:url\" content=\"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/\" \/>\n<meta property=\"og:site_name\" content=\"Tech Howtos\" \/>\n<meta property=\"article:published_time\" content=\"2014-06-27T20:58:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-24T19:22:21+00:00\" \/>\n<meta name=\"author\" content=\"Etapien\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Etapien\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/\",\"url\":\"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/\",\"name\":\"How to password protect a directory with .htaccess\",\"isPartOf\":{\"@id\":\"https:\/\/etapien.com\/guides\/#website\"},\"datePublished\":\"2014-06-27T20:58:08+00:00\",\"dateModified\":\"2020-08-24T19:22:21+00:00\",\"author\":{\"@id\":\"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424\"},\"description\":\"password protect directory in apache, .htaccess\",\"breadcrumb\":{\"@id\":\"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/etapien.com\/guides\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to password protect a directory with .htaccess\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/etapien.com\/guides\/#website\",\"url\":\"https:\/\/etapien.com\/guides\/\",\"name\":\"Tech Howtos\",\"description\":\"Tech related useful howtos\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/etapien.com\/guides\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424\",\"name\":\"Etapien\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/etapien.com\/guides\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g\",\"caption\":\"Etapien\"},\"url\":\"https:\/\/etapien.com\/guides\/author\/Etapien\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to password protect a directory with .htaccess","description":"password protect directory in apache, .htaccess","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:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/","og_locale":"en_US","og_type":"article","og_title":"How to password protect a directory with .htaccess","og_description":"password protect directory in apache, .htaccess","og_url":"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/","og_site_name":"Tech Howtos","article_published_time":"2014-06-27T20:58:08+00:00","article_modified_time":"2020-08-24T19:22:21+00:00","author":"Etapien","twitter_misc":{"Written by":"Etapien","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/","url":"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/","name":"How to password protect a directory with .htaccess","isPartOf":{"@id":"https:\/\/etapien.com\/guides\/#website"},"datePublished":"2014-06-27T20:58:08+00:00","dateModified":"2020-08-24T19:22:21+00:00","author":{"@id":"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424"},"description":"password protect directory in apache, .htaccess","breadcrumb":{"@id":"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/etapien.com\/guides\/password-protect-directory-htaccess\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/etapien.com\/guides\/"},{"@type":"ListItem","position":2,"name":"How to password protect a directory with .htaccess"}]},{"@type":"WebSite","@id":"https:\/\/etapien.com\/guides\/#website","url":"https:\/\/etapien.com\/guides\/","name":"Tech Howtos","description":"Tech related useful howtos","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/etapien.com\/guides\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424","name":"Etapien","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/etapien.com\/guides\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g","caption":"Etapien"},"url":"https:\/\/etapien.com\/guides\/author\/Etapien\/"}]}},"_links":{"self":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts\/151"}],"collection":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/comments?post=151"}],"version-history":[{"count":1,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts\/151\/revisions"}],"predecessor-version":[{"id":152,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts\/151\/revisions\/152"}],"wp:attachment":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/media?parent=151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/categories?post=151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/tags?post=151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}