How To Add Password Protection To a Website For Multiple Users

Adding Password Protection to a website is easy. Use a couple of special web configuration files called .htaccess and .htpasswd with a text editor and you’re sorted. However, we make it even easier to add password protection to an entire website or a specific directory (folder). Plus, you can provide access for multiple users with unique details. Just use our built in Password Protection app available in our web hosting control panels.

You can watch the ‘Adding password protection’ video above or follow along trough the written transcript below. All our Video tutorials are also available to view in the customer dashboard. If you don’t already have an account with us, create one today for Free!

Adding Password Protection Video Transcript.

Adding Password protection to specific areas of your website is a great way to ensure that your content is only available to a select few. This could be because you are working on a new site and therefore want to password protect access to it. This would mean only those you invite with a username and password could view your progress. Perhaps you have content that you only wish to share with family and friends, and so you can place this in a separate directory and lock it away behind a secure login. Or maybe you have content you wish to restrict to members or those paying for access.

Whatever your motivation for securing your website content, it’s fairly straight forward to add password protection with a .htaccess file using a text editor. But we make that task even easier for you with the web tools available in our web hosting control panel.

Protecting the Correct Website Files

The first thing we need to know is the correct path to the directory we wish to secure. So, from our web hosting control panel, we can open the ‘File Manager’. Remember, that a directory is just another name for a folder within your website. In this case, we are going to secure a sub directory called ‘members-area’, which we can see here. Any content placed inside of this directory, will only be available to visitors that have a valid username and password once we have setup our Password Protection.

As this directory is one level in from the root of our website, indicated by the public_html directory, the path will be our domain name, forward slash members area yourdomain.com/members-area. If instead we wanted to secure a directory within members-area, such as the documents directory seen here, then the path would be our domain name forward slash members area, forward slash documents yourdomain.com/members-area/documents.

Now we understand that, we can return back to our main hosting control panel. Scroll down to the ‘Web Tools’ section, and choose ‘Password Protection’.

Add And Remove Password Protection

As we are going to be adding password protection to a website directory, we need the ‘Add and Remove Password Protection’ section. In here, we can see the path to the root of our website already exists. If we wanted to password protect our entire website, we would leave the field blank. But, as we want to password protect just our ‘Members Area’, we need to enter the name of that directory here, like so.

The next step is to enter a username, and a password, and then click on the Add Protection button. That’s it! We have now secured our ‘Members Area’. If we go and visit that page on our website now, we are presented with the login challenge. When we enter our Username and Password, we get full access.

But what if you want to add more users, each with their own unique usernames and passwords?

Adding Password Protection For More Users

Lets’s go back to the Password Protection area of our Web Hosting control panel. This time look at the next section titled ‘Edit Password Protection’. When we add password protection, we are actually creating a couple of special hidden files called .htaccess and .htpasswd. To be able to make changes to our list of permitted users, we first need to load those files into the editor. We do this by entering the correct path to the directory we have secured just like we did before… and click on ‘Retrieve Directory Information’.

We can now see our list of users with access and begin to add new users just as we did for the first user. You can also remove users from the list by ticking the appropriate checkbox and hitting delete.

If you wish to completely remove the password protection from your directory, it’s just as easy as adding it. Return back to the main Password Protection area, enter the directory path into the first section titled ‘Add and Remove Password Protection’, and click on Delete Protection.

That’s it. You now know how to add password protection to your main website or a sub directory. You have also learnt how to update the users with access to your secure website area and how to completely delete the password protection when it is no longer required.

Leave a Comment

Your email address will not be published. Required fields are marked *