• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Protect Entire Domain (doc root) with htaccess and htpasswd - Not working

F

fishnyc22

Guest
I'm trying to password protect my entire httpdocs directory while in development. (then disabling it later when ready for launch)

I had it working great last week, but made some changes somewhere (not sure what did it) and now I cant get it to work. I've gone though the process over and over again with now luck.

I have my .htaccess file with:

AuthType Basic
AuthName "Development Access"
AuthUserFile /etc/apache2/passwd/.htpasswd
Require valid-user

I ran the command:
htpasswd -c /etc/apache2/passwd/.htpasswd USERNAME

and entered the password 2x. Restarted Apache with:

/etc/rc.d/init.d/httpd restart

But no luck. The directory is not protexted. I even tried:

chmod a+r .htaccess
chmod a+r .htpasswd

I'm not sure why it would work and then stop working. all I did was try to add a second user to the .htpasswd file.

Does any one know if there is ANYTHING else I need to do to make this work.

Any help would be appreciated!
I'm running Plesk 8 / Apache2 / Fedora Linux

Fish ><>
 
After doing a little more research, I noticed that I am able to protect another site with the same htpasswd file basically the same .htaccess file:

AuthType Basic
AuthName "Development Access Area"
AuthUserFile /etc/apache2/passwd/.htpasswd
Require user USER1 USER2

Why would this work on one vhost domain and not the other.

Anyone with any thoughts on this would really be helping me out a lot.

thanks

Fish
><>
 
I figured it out after doing a little more research. apparantly. I needed to let plesk know to use the vhost.conf file with this command:

/usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain.com

I don't understand why I would need to do this for one domain and not the other.

any thoughts?

Thanks
 
Back
Top