Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the Bitnami Wampstack installed running 2 different websites, each with two different URLs. The virtual hosts are set up as follows:

NameVirtualHost *:83
NameVirtualHost www.first.co.za:83
NameVirtualHost www.first.net:83

<VirtualHost www.first.co.za:83>
  ServerName www.first.co.za:83
  DocumentRoot "C:/Program Files/BitNami WAMPStack/apache2/htdocs/joomla2"
</VirtualHost>

<VirtualHost www.second.net:83>
  ServerName *:83
  DocumentRoot "C:/Program Files/BitNami WAMPStack/apache2/htdocs/joomla"
</VirtualHost>

<VirtualHost www.second.co.za:83>
  ServerName www.second.co.za:83
  DocumentRoot "C:/Program Files/BitNami WAMPStack/apache2/htdocs/joomla"
</VirtualHost>

<VirtualHost www.first.net:83>
  ServerName www.first.net:83
  DocumentRoot "C:/Program Files/BitNami WAMPStack/apache2/htdocs/joomla2"
</VirtualHost>

Three of the URLs redirect correctly, but the fourth, www.first.co.za, displays the website for www.second.net, which seems to be default. What is wrong with my configuration?

share|improve this question

migrated from stackoverflow.com Jun 9 '11 at 11:08

This question came from our site for professional and enthusiast programmers.

    
@Corne. You do realise that the 3rd virtual host is pointing to the same directory as the second vhost, don't you? –  Ben Jun 9 '11 at 8:15
    
Yes, that is how it should be, since hosts 2 and 3 are different URLs for the same website. The issue is with the first one, which should redirect to the joomla2 folder, but shows the joomla folder instead. –  Corne Beukes Jun 9 '11 at 11:46
    
You can check how apache sees to configuration by running apachectl -S (apache2ctl on some os). Please attach the command's output to your question. –  jkj Jun 9 '11 at 12:05

1 Answer 1

up vote 1 down vote accepted

Since you only really have two sites, I'd recommend to only set up two virtual hosts and do the rest with aliases, like this:

NameVirtualHost *:83

<VirtualHost *:83>
ServerName www.first.net
ServerAlias www.first.co.za
DocumentRoot "C:/Program Files/BitNami WAMPStack/apache2/htdocs/joomla2"
</VirtualHost>

<VirtualHost *:83>
ServerName www.second.net
ServerAlias www.second.co.za
ServerAlias *
DocumentRoot "C:/Program Files/BitNami WAMPStack/apache2/htdocs/joomla"
</VirtualHost>

This removes the redundancies and makes for clearer reading, plus it's easier to maintain.

share|improve this answer
    
Thank you for the answer, although it wasn't quite correct for me. I set up the config according to your answer, but the alias for the second vhost was redirecting to the first vhost, so I added another vhost for that alias and then it worked. Thank you. –  Corne Beukes Jun 9 '11 at 14:45

Your Answer

 
discard

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.