Login forms on your website allows you to set a password to limit access to your website (or parts of it). Let’s go through different options of how can it be done:

Option 1 - hPanel

Easiest way of doing it would be enabling Password Protect Directories feature on hPanel, a step-by-step guide can be found in this article.

Option 2 - WordPress plugin

One of the better security plugins - WordFence allows you to enable two-factor authentication (2FA) or even use the login page CAPTCHA feature to prevent any bot attempts to log in to your website.

Option 3 - .htaccess

You can password protect a directory by creating a .htaccess file in a directory you want to protect.

You will also need to create a .htpasswd file that can be anywhere on your system (somewhere safe and private as putting .htaccess and .htpasswd files on the same folder is not recommended). The content of .htaccess file should look like this:

AuthType Basic
AuthName "Your authorization required message."
AuthUserFile /path/to/.htpasswd
require valid-user

Be sure to replace /path/to/.htpasswd with actual path. Once that’s done, create a .htpasswd file using whatever username and password you want:

username:<generated_password>

That's it! Your website will be password protected 😊

Did this answer your question?