• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Password Protecting a directory

C

Coldfusion2006

Guest
Most control panels have a nice and easy way to .htaccess protect folders

Plesk has a nice way by allowing you to click "Directories"

When you have clicked this it opens up a new window and asks if want to Add a New Directory.

It protects standard directories or domains fine..

Example http://example.com (Works Fine)


Example http://subdomain.example.com (Doesnt Work)

What am I missing?

Another issue that I dont like so far with my plesk panel, is how it divides http and https folders... Why not just use one single folder?
 
I'm not sure about password protecting subdomain directories from the control panel. I ususlly just do it from the shell. Create an .htaccess file in the directory you want to protect, and run htpasswd on the username to create a password file. Post back if you need detailed steps.

For putting http and https in a single directory, there is a setting for that under the "Setup" icon. Look for the setting "Use a single directory for housing SSL and non-SSL content"
 
Originally posted by TXRanger
I'm not sure about password protecting subdomain directories from the control panel. I ususlly just do it from the shell. Create an .htaccess file in the directory you want to protect, and run htpasswd on the username to create a password file. Post back if you need detailed steps.

For putting http and https in a single directory, there is a setting for that under the "Setup" icon. Look for the setting "Use a single directory for housing SSL and non-SSL content"

That would be great! Please tell me how!
 
Create a file in the directory you want to password protect called ".htaccess". I create the file from the shell using vi, but you should be able to create it from the shell or the control panel. Example from command line (assuming you know how to use vi / vim and your subdomain is test.yourdomain.com):
Code:
vim /home/httpd/vhosts/yourdomain.com/subdomains/test/.htaccess

Then use the following code (replace yourdomain.com with your real domain name):
Code:
AuthUserFile /home/httpd/vhosts/yourdomain.com/access.pwd
AuthGroupFile /dev/null
AuthName "My protected directory"
AuthType Basic

<Limit GET>
   require user Coldfusion2006
</Limit>

Then create the file to hold the password(s) with the following command from the shell:
Code:
htpasswd -c /home/httpd/vhosts/yourdomain.com/access.pwd Coldfusion2006
It will then prompt you for the password you want to use for the user "Coldfusion2006". After you enter and confirm your password it should work.
 
Back
Top