{"id":833,"date":"2013-08-27T14:48:36","date_gmt":"2013-08-27T09:18:36","guid":{"rendered":"http:\/\/techkunji.com\/?p=833"},"modified":"2014-09-19T23:34:23","modified_gmt":"2014-09-19T18:04:23","slug":"password-protect-a-website-or-sub-directory","status":"publish","type":"post","link":"https:\/\/cms.viralmediatoday.com\/2013\/08\/27\/password-protect-a-website-or-sub-directory","title":{"rendered":"Password Protect a Website or Sub-directory: Steps"},"content":{"rendered":"<p>Recently I was setting up a back-end admin page for a site and I wanted it to be only accessible by <span id=\"63b8ed0b-0e44-45be-a808-f304696ffeb4\" class=\"GINGER_SOFTWARE_mark\">admins<\/span>. So I came across an article by Chris Coyier on <a href=\"http:\/\/css-tricks.com\/easily-password-protect-a-website-or-subdirectory\/\" target=\"_blank\" rel=\"noopener\">css-tricks.com<\/a>. But the article was for advanced users. A newbie like me will end up getting errors. I ended up getting 500 Server error and after hours of Googling I was able to set it up properly. Follow the steps below and you will be able to password protect a website or sub-directory\u00a0in no time.<\/p>\n<h2>Steps:<\/h2>\n<p><span style=\"text-decoration: underline;\"><strong>Creating .htaccess and .htpasswd files<\/strong><\/span><\/p>\n<p>Visit\u00a0<a href=\"http:\/\/www.tools.dynamicdrive.com\/password\/\" target=\"_blank\" rel=\"noopener\">http:\/\/www.tools.dynamicdrive.com\/password\/<\/a>\u00a0to generate the contents for <span id=\"53d30576-1b73-4664-9702-13d6b09379a1\" class=\"GINGER_SOFTWARE_mark\">your<\/span>\u00a0.htaccess and .htpasswd files. It&#8217;s a free online\u00a0.htaccess Password Generator.<\/p>\n<p><a href=\"https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htacces-generator.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-835\" style=\"border: 1px solid orange; margin-top: 1px; margin-bottom: 1px;\" src=\"https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htacces-generator.png\" alt=\"password protect website\" width=\"944\" height=\"599\" srcset=\"https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htacces-generator.png 944w, https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htacces-generator-300x190.png 300w\" sizes=\"auto, (max-width: 944px) 100vw, 944px\" \/><\/a><\/p>\n<ol>\n<li>Enter <span id=\"590ee0ff-38be-4503-b080-1315c9c758c6\" class=\"GINGER_SOFTWARE_mark\">usernames<\/span>, one per line<\/li>\n<li>Enter passwords for the <span id=\"53a3decb-6099-428b-8f3b-db85b70a5094\" class=\"GINGER_SOFTWARE_mark\">usernames<\/span> on the left<\/li>\n<li>Enter <span id=\"8cb2d5c0-229d-4cfc-b2cc-0466e1c7eece\" class=\"GINGER_SOFTWARE_mark\">filepath<\/span> where you will be storing your .htpasswd (If you don&#8217;t know the <span id=\"c694dde7-e2e3-4344-8903-40d138510ad7\" class=\"GINGER_SOFTWARE_mark\">filepath<\/span>, read the end of the article).<\/li>\n<li>Submit<\/li>\n<\/ol>\n<p>After submitting you will get a page with <span id=\"4d9e4e73-c320-4eca-b05c-cfdbe75b0d86\" class=\"GINGER_SOFTWARE_mark\">your<\/span> .htaccess and .htpasswd codes.<\/p>\n<p><a href=\"https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htacces-password-generator.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-837\" style=\"border: 1px solid orange; margin-top: 1px; margin-bottom: 1px;\" src=\"http:\/\/techkunji.com\/wp-content\/uploads\/2013\/08\/htacces-password-generator.png\" alt=\"htacces password generator\" width=\"911\" hei<\/a srcset=\"https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htacces-password-generator.png 911w, https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htacces-password-generator-300x176.png 300w\" sizes=\"(max-width: 911px) 100vw, 911px\" \/><\/p>\n<p>Create 2 files .htaccess and .htpasswd in the file directory you want to protect and copy paste the codes from the above site to the respective file.<\/p>\n<p><a href=\"https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htaccess-location-for-password-protection.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-838\" style=\"border: 1px solid orange; margin-top: 1px; margin-bottom: 1px;\" src=\"https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htaccess-location-for-password-protection.png\" alt=\"htaccess location for password protection\" width=\"680\" height=\"373\" srcset=\"https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htaccess-location-for-password-protection.png 680w, https:\/\/cms.viralmediatoday.com\/wp-content\/uploads\/2013\/08\/htaccess-location-for-password-protection-300x164.png 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/a><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Finding the path of of the folder where you will be storing your password file (.htpasswd)<\/strong><\/span><\/p>\n<p>This is for people who don&#8217;t know the full path of your site directory.<\/p>\n<p>Visit\u00a0<a href=\"http:\/\/www.htaccesstools.com\/articles\/full-path-to-file-using-php\/\" target=\"_blank\" rel=\"noopener\">http:\/\/www.htaccesstools.com\/articles\/full-path-to-file-using-php\/<\/a>\u00a0and follow the instructions to find your full path of your site directory.<\/p>\n<p>I have tried to keep the steps as simple as possible. If you run into some error, let me know through the comments and I will help you sort it out.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I was setting up a back-end admin page for a site and I wanted it to be only accessible by admins. So I came across an article by Chris Coyier on css-tricks.com. But the article was for advanced users. A newbie like me will end up getting errors. I ended up getting 500 Server [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":846,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72],"tags":[74,76,30],"class_list":["post-833","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hosting","tag-htaccess","tag-security","tag-website"],"_links":{"self":[{"href":"https:\/\/cms.viralmediatoday.com\/api\/wp\/v2\/posts\/833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cms.viralmediatoday.com\/api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cms.viralmediatoday.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cms.viralmediatoday.com\/api\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cms.viralmediatoday.com\/api\/wp\/v2\/comments?post=833"}],"version-history":[{"count":0,"href":"https:\/\/cms.viralmediatoday.com\/api\/wp\/v2\/posts\/833\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cms.viralmediatoday.com\/api\/wp\/v2\/media\/846"}],"wp:attachment":[{"href":"https:\/\/cms.viralmediatoday.com\/api\/wp\/v2\/media?parent=833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cms.viralmediatoday.com\/api\/wp\/v2\/categories?post=833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cms.viralmediatoday.com\/api\/wp\/v2\/tags?post=833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}