Welcome to my blog!

Here I try to keep useful information about IT, mostly related to Web development and Linux stuff. Any comments or feedback that you might have will be much appreciated!

Thanks,
Tomi

Password protecting subdomains with Plesk

Filed Under (Plesk) by admin on 16-09-2006

If you need to password protect a directory that is hosted under a subdomain with Plesk, you’ll find that it is not quite as easy as protecting a directory that is avaliable directly from the main domain.

Here is what I did as a workaround:

Step One
Create a fake password protected directory on the main domain (domain -> Directories -> Add New Direcotry) with something that does not exist on the domain and can be easily identified, for example s-sample.

Step Two
Create the necessary users for that protected directory from within Plesk.

Step Three
Open your domain’s base httpd configuration file, which will be on /var/www/vhosts/(domain)/conf/httpd.include
and loook for a line that contains

Copy the lines between and , it should be something like:

AuthType Basic
AuthName "Restricted"
AuthUserFile /var/www/vhosts/(domain)/pd/d..s-sample
require valid-user

Step Four
Create the .htaccess file using the text from step three, and place it on the directory that you wish to protect on the subdomain.

Done!
If everything went fine, now your browser should request a user name and password, as provided from Plesk’s interface.

The provided solution was used with Plesk 7.5.4 for Linux.

Leave a Reply

You must be logged in to post a comment.