Password protecting subdomains with Plesk
September 16th, 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
<Directory "/var/www/vhosts/(domain)/httpdocs/s-sample">
Copy the lines between <Directory> and </Directory>, 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.
Entry Filed under: Plesk
Leave a Comment
You must be logged in to post a comment.
Trackback this post | Subscribe to the comments via RSS Feed