{"id":18596,"date":"2024-05-24T20:32:26","date_gmt":"2024-05-24T20:32:26","guid":{"rendered":"https:\/\/hostvento.com\/kb\/web-hosting\/getting-started-guide\/how-to-use-the-knowledge-base\/steps-to-enable-password-protection-for-htaccess\/"},"modified":"2024-06-17T08:53:23","modified_gmt":"2024-06-17T08:53:23","slug":"steps-to-enable-password-protection-for-htaccess","status":"publish","type":"docs","link":"https:\/\/www.hostvento.com\/kb\/docs\/hosting-faqs\/steps-to-enable-password-protection-for-htaccess\/","title":{"rendered":"Steps to Enable Password Protection for .htaccess?"},"content":{"rendered":"\n<p>The article reveals the steps to enable .htaccess password protection.<\/p>\n\n\n\n<p>1. Firstly, create an&nbsp;<strong>.htpasswd<\/strong>&nbsp;file with your own username and password in any text editor and save it without the .txt extension. Encrypt the password for extra protection.<\/p>\n\n\n\n<p>2. After visiting the link, just enter the username and password. This will generate the code for you that you just need to copy and paste. In this example, the username was&nbsp;<strong>\u2018abc\u2019<\/strong>&nbsp;and password too was&nbsp;<strong>\u2018abc\u2019<\/strong>&nbsp;and so the result was \u2013&nbsp;<strong>abc:9476nIHW7Esgw<\/strong>. But it generates a new one each time.<\/p>\n\n\n\n<p>3. Next, create an .htaccess file with the below code. You can use any text editor save it without the .txt extension. Don\u2019t miss to check the .<strong>htpasswd<\/strong>&nbsp;file\u2019s location or else it won\u2019t work.<\/p>\n\n\n\n<p>4. It is possible to change the \u2018Login Details\u2019 to anything you want to be displayed on the pop-up alert.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">AuthUserFile \/home\/user\/domain\/secretfolder\/.htpasswd\nAuthType Basic\nAuthName \u201cLogin Details\u201d\nRequire valid-user<\/pre>\n\n\n\n<p>5. Both these files need to be uploaded in the same folder which you want to be secure. Now, if any other user than you tries to access that directory or any files in it, they will be asked for login details. So, your web directory is now secured with the password.<\/p>\n\n\n\n<p><strong>NOTE<\/strong>&nbsp;\u2013 You won\u2019t be able to see these files on your server as they are hidden files. You can view the Filezilla FTP client and check the&nbsp;<strong>\u201cforce showing hidden files\u201d<\/strong>&nbsp;option to view these files. You can also create these files easily in Notepad but save them without .txt extension (Save a type \u2013 select&nbsp;<strong>\u201cAll Files\u201d<\/strong>, then you can save without any extension). In case the Login window keeps popping up, it indicates that your login details are wrong.<\/p>\n\n\n\n<p>That\u2019s it! You have now learned to enable password protection for .htaccess.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The article reveals the steps to enable .htaccess password protection. 1. Firstly, create an&nbsp;.htpasswd&nbsp;file with your own username and password in any text editor and save it without the .txt extension. Encrypt the password for extra protection. 2. After visiting the link, just enter the username and password. This will generate the code for you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":23377,"menu_order":91,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-18596","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/18596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/comments?post=18596"}],"version-history":[{"count":2,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/18596\/revisions"}],"predecessor-version":[{"id":18598,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/18596\/revisions\/18598"}],"up":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/23377"}],"wp:attachment":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/media?parent=18596"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/doc_tag?post=18596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}