If you want to hide some content of your website from some visitors but you want to display the content to some other visitors then you need to create password protected directory. Create a password protected directory, put the content which you want to hide from some visitors then give the username and password to only those visitors to whom you want to give the access.
There are two different ways using which you can create a password protected directory. One is by using .htaccess and .htpasswd files and the other is by using DreamHost panel.
The first way of using .htaccess and .htpasswd files is for technical people. There is a much simpler way of doing this using DreamHost panel. I would suggest even a technical person to use DreamHost panel. Why go to with complex way when there is simple way. Let’s take an example.
Create Password Protected Secure Directory
In this article, I will take you to the step by step guide for setting password protected directory. Let’s say, I want to protect https://dhdjdj.com/private/. In the private directory, I have setup some content which I don’t want all visitors to see. First I need to create the directory named “private” under document root. If you don’t create it then also it’s fine because DreamHost will create it automatically while setting up the password protection.
Follow these steps to create secure directory.
1) Go to DreamHost Panel and login to your account using username and password.
2) In the left side menu, click on Goodies section. Then click on Htaccess/WebDav link.
3) Here you will see all the hosted domains list. Select the domain for which you want to setup password protection. We will select https://www.dhdjdj.com/ .
4) On this page, you will see a list of all secured directory for the select domain. Click on Setup A New Directory button.
5) On this page, enter directory name. Since we want to make private directory secure, enter private in directory name field. Check the checkbox which says, “Password-protect this dir?”. In Directory “name” field, enter the description. Then enter the username and password in user accounts area. Username and password must be in “username password” format. We will use “secure demo” in the field. So secure is the username and demo is the password. Leave all other options as it is.
6) Click on Configure This Directory button. You will see success message and also get email from DreamHost.
Once you get the email from DreamHost, check the setup to make sure that every thing is properly set.
Check Password Protected Directory
Now visit the URL which you just secured. You will see a popup asking for username and password. Enter the username “secure” and password “demo”.
Click on Login button and you should see the content of private directory.
I have tried to explain each and everything in details. Now go ahead and create password protected directory.