
A .htpasswd file typically creates and updates stored usernames and passwords for HTTP users using HTTP authentication. You must create a .htpasswd file to secure the website’s content, whether the primary URL or some subdirectory. Only authorized users will be able to access the website’s source. The username and password in the file are inline, separated by a colon. The username is stored in plain text, and the password is hashed, usually with MD5 encryption.
The .htpasswd is in the .htaccess file in the website’s document root. The .htaccess file is a configuration file used by Apache-based web servers. Many possibilities exist with the .htaccess file, and one of them is including the .htpasswd file.
In this post, we will use already installed WordPress with the LAMP stack on Ubuntu 24.04 OS to configure HTTP authentication with the .htpasswd file. Creating and configuring it is straightforward and may take around 5 minutes. Let’s get started!

