Back to Blog
Dotkernel

Protecting admin folder with .htaccess in Plesk

In /var/www/vhosts/exampledomain.com/conf/vhost.conf file add this code:
>
< Location /admin>
   AuthType Basic
   AuthName "My Site Admin"
   AuthUserFile /var/www/vhosts/exampledomain.com/conf/.htpasswd
  Require valid-user
< /Location >
  Notice the server that vhost.conf has been added/changed with command:
>/usr/local/psa/admin/sbin/websrvmng -a
  Then create the .htpasswd file and upload it to /var/www/vhosts/exampledomain.com/conf/