Overview
This article explains how to password secure your website or a subdirectory of your website using the panel.
You don’t have access to your.htaccess or.htpasswd files.
The methods in this article produce an.htaccess and.htpasswd file that the server owns. This implies that if you need to manually change either of these files, you won’t be able to do so. Furthermore, any existing.htaccess file will be overwritten by these instructions. Before starting these instructions, make a backup of your existing.htaccess file.
If you’ll require access to your.htaccess and.htpasswd files in the future, you should instead follow the instructions in this article.
With an.htaccess file, you can secure your website with a password.
These steps will show you how to build your.htaccess and.htpasswd files manually.
Creating an .htaccess file in your panel
To get started, go to the Htaccess/WebDAV website.
Select the domain you want to secure with a password.
The Htaccess/WebDAV page displays a list of your domains. In order to appear here, domains must be fully hosted:
To create a new directory, click the Set Up a New Directory button.
The following is the WebDAV configuration page:
Make your decisions based on the facts provided in the table below.
Action and Description of the Field
Name of the directory
Enter the directory you want to keep safe (leave it blank to protect the entire domain.)
NOTE: You must first create a subfolder in your FTP account if you want to password secure it.
Is it possible to password-protect this directory?
This box should be checked.
Is it possible to enable WebDAV on this directory?
If you don’t need to use WebDAV on this domain, uncheck this box.
“name” of the directory
Fill in the name of the location you’d want to call it (this appears in the pop-up window asking for your password).
This area’s user accounts
Enter a username and password for the password-protected domain/directory. A single username password in the pattern ‘username password’ appears on each line. ‘username1’ uses the password ‘password1’ in the screenshot above.
Is it possible to disable linking to files in this directory?
If you want to prevent particular file types from being opened, check this option.
File extensions that aren’t allowed
Here’s where you’ll put the extensions that aren’t allowed.
Domains that may or may not still be linked
Add domains that will be able to view this material without being blocked.
Scroll to the bottom of the page and click the Configure This Directory button once you’ve finished making your selections.
This directory on your site is secured in less than ten minutes.
Testing the .htaccess file
Once everything is set up, a new.htaccess and.htpasswd file will appear in the root directory of your website. The following code is in the.htaccess file:
Replace username with your Shell username, and example.com with the URL of your website.
Gregghost generated this page. DO NOT CHANGE!!! ### AuthType Basic AuthUserFile /home/username/example.com/public/.htpasswd AuthName “Members Area” need valid-user
The encrypted password you chose for username1 is only shown in the.htpasswd file:
username1:$1$MVq7Nkc/$GTaN0dRkCsiXJpFNxYs8V.
A pop-up authentication box shows when you visit your website in a browser, asking you to enter your credentials:
03 Directory Password Protection.fw.png
The site can only be accessed by the users you added to the ‘User accounts for this area’ field in the panel.