0

I have two domains aliased to the same Apache vhost and thus targeting the same document root. The CMS installed in that doc root reacts with completely different websites depending on the domain that was used to access it.

I now need to implement a basic auth (in vhost config or .htaccess) that protects only ONE of the two websites. So access through one domain must be protected, while the other stays fully accessible.

My problem is that I do not find any Apache block directive that fires depending on the domain used for the access or depending on a server environment variable like HTTPHOST:

  • <Directory> and <Files> are not appropriate as the target directory is the same for both domains.
  • <Location> only looks at the path but not the domain.
Jpsy
  • 20,077
  • 7
  • 118
  • 115
  • 1
    See my answer here: http://stackoverflow.com/a/7458077/851273 – Jon Lin Jun 15 '12 at 14:52
  • Hi Jon, I really missed that one - although I did an extensive search before I asked. My question is a full duplicate. Thanks for pointing into the right direction. – Jpsy Jun 15 '12 at 16:03
  • I thought about closing this question and marking it as duplicate. But I decided against that as I think that my question contains a completely different set of words to describe the problem. As I unsuccessfully searched for an answer (using basically the same wording) before I posted my own question, this may guide more people to that other question (containing the solution). – Jpsy Jun 18 '12 at 14:35

0 Answers0