Inhaltsverzeichnis
Create .htaccess File. #
AuthType Basic
AuthName "Secure Content"
AuthUserFile /home/myuser/public_html/.htpasswd
require valid-user
Create Users in .htpasswd #
Now start with creating users in .htpasswd defined in .htaccess file. You can add user and password either in plain text or md5 encrypted.
Adding password in plain text format:
htpasswd -c /home/myuser/public_html/.htpasswd myuser
Adding password with md5 crypt format
htpasswd -cm /home/myuser/public_html/.htpasswd myuser
- -c : is used only for first time when you create .htpasswd file. If you use it second time, it will remove existing file and recreate new one.
- -m : is used to save password in md5 format.
Aus <https://tecadmin.net/configure-basic-authentication-in-apache-using-htaccess/>