How do I block access to the website or its part with a password?
  ru en
Help
Print version

How do I block access to the website or its part with a password?

Option 1 — using the control panel

Use Directories button in Plesk domain control panel to create the password-protected directory, as well as to set a password to protect access to the complete website. Please note that this feature is available only for domain names with physical hosting.

Option 2 — using .htaccess

It shall be necessary to place .htaccess file in the folder the access to which shall be restricted. The file shall contain the following lines:
    AuthType Basic
     AuthName name
     AuthUserFile “/usr/local/www/vhosts/website.name/httpdocs/folder.name/.htpasswd”
     <Limit GET POST>
            Require valid-user
     </Limit>

where "name" is the name of your resource (whatever you want it to be) which will be displayed at authorization request,
"login" is your account name (as indicated in the agreement),
"website.name" is the name of the folder where your website is stored in your home folder at your server,
"folder.name" is the name of the folder to be protected.

Then, .htpasswd file shall be created in one folder with .htaccess. It shall contain information on login of the user allowed to access your website (there may be several users), as well as the password encrypted by UNIX Crypt algorithm. The password and login shall be colon-separated. You can encrypt your password, for example, here: https://www.ripe.net/cgi-bin/crypt.cgi. After this has been done, access to the website or its part will be available only when login and password are entered.

Copyright © 2000-2025 Registrar R01
Information: info@r01.ru
Support: support@r01.ru
Office: 1 Bolshoy Gnezdnikovsky Lane, building 2, Moscow (Tverskaya metro station, entrance No. 9, Voznesensky business center)