You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ben Roberts <li...@headsnet.com> on 2007/02/02 15:48:26 UTC

[users@httpd] Configuring htpasswd only for specific ServerAlias

Does anybody know if it's possible to apply htpasswd authentication to a 
particular directory ONLY if a specific ServerAlias is requested.

e.g. I have a single virtual host container, with 2 server aliases:

<VirtualHost 1.2.3.4:80>
         ServerName www.domain.com
	ServerAlias foo.domain.com

	<Directory /home/user/www>
	        AuthType Basic
	        AuthName "My Server"
	        AuthUserFile /home/user/.htpasswds
	        Require user myuser
	</Directory>

</VirtualHost>

Basically I just want the htpasswd authentication to apply if the server 
name requested is foo.domain.com and not www.domain.com

I know this can be done by creating a new virtual host container for 
foo.domain.com instead of using a serveralias, but I'd rather not do 
that if possible.

Thanks

Ben


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Configuring htpasswd only for specific ServerAlias

Posted by Ben Roberts <li...@headsnet.com>.
>> I know this can be done by creating a new virtual host container for
>> foo.domain.com instead of using a serveralias, but I'd rather not do
>> that if possible.
> 
> Why not?  <VirtualHost> sections are designed for exactly this purpose.
> 
> Joshua.

Yes I suppose so. I've also realised I now need to configure logging for 
each server alias separately, so it does make sense to create multiple 
virtual host containers and then Include a file containing all the 
common configuration directives

Thanks

Ben



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Configuring htpasswd only for specific ServerAlias

Posted by Joshua Slive <jo...@slive.ca>.
On 2/2/07, Ben Roberts <li...@headsnet.com> wrote:

> I know this can be done by creating a new virtual host container for
> foo.domain.com instead of using a serveralias, but I'd rather not do
> that if possible.

Why not?  <VirtualHost> sections are designed for exactly this purpose.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org