Password protect (http auth) all domains on server

rpilb

Registered
Mar 12, 2016
2
0
1
London
cPanel Access Level
Root Administrator
Hi

How can I password protect all domains/sites on a server with http auth?

I added the following into httpd.conf but pressing cancel on the auth popup will show the page contents without any assets loading.

<Directory "*">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /.htpasswd
Require valid-user
</Directory>
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Hello :)

What method are you using to make changes to the Apache configuration? It's important to use the instructions at:

Advanced Apache Configuration - EasyApache - cPanel Documentation

Also, I believe the directory has to be specific, as opposed to entering a wildcard character. How many accounts do you need to protect?

Thank you.
 

rpilb

Registered
Mar 12, 2016
2
0
1
London
cPanel Access Level
Root Administrator
I edited the httpd.conf directly just to test it but reverted it back after - I did see the message about it being overwritten and making sure to run the distiller.

Is there alternative to using a wildcard? The server is essentially a testing server - it needs to be locked off from Google to stop client websites being indexed, but access from any IPs so we can't lock it down that way. They're all setup on a subdomain i.e. website1.testingserver.com

We can modify each account but it's quite tedious as there's 100+ on there at the moment.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Is there alternative to using a wildcard? The server is essentially a testing server - it needs to be locked off from Google to stop client websites being indexed, but access from any IPs so we can't lock it down that way. They're all setup on a subdomain i.e. website1.testingserver.com
If the goal is to prevent Google or other search engines from indexing the websites, then you could setup rules to prevent that. There's a third-party thread on this at:

Stop Google from indexing

Thank you.