Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it posible to protect a website if the site was called by a given domain name?

e.g. -> no password protection -> password protection

Both of the URLs are routed to the same document root.

share|improve this question
I found this page:… – SamK Oct 10 '11 at 14:07

If you have multiple virtualhosts, you can add password protection to one and not the other via the following directive:

<VirtualHost *:80>
DocumentRoot /www/example1

<VirtualHost *:80>
DocumentRoot /www/example1
<Directory "/www/example1">
AuthType Basic
AuthName "Protected Site"
AuthUserFile /etc/httpd/passwd
Require user joeuser

Here is more information on this:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.