first name based virtual host taking precedence over all others

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks,

I'm running Apache on a Ubuntu 12.04 virtual machine.

I have multiple URL's pointing to the machine, and have been using a
Drupal multi-site instance on the server to direct users to the correct
content depending on URL. So, until just recently, I haven't needed name
based virtual host directives because I've been using Drupal.

However, we just set things up to use the Drupal instances as a staging
area, and are now hosting the content on a static site elsewhere.

So, we would like to point the top level URL's (home pages) ONLY to the
new static sites, and keep deeper links pointing to the original server.

In other words, the desired behavior is that:
http://one.example.machine.org/ -> http://another.machine.org/one
http://two.example.machine.org/ -> http://another.machine.org/two
And URLs like:
http://one.example.machine.org/somepage.html
http://two.example.machine.org/someotherpage

don't get redirected.

So, I set up two name based virtual hosts, one each for
one.example.machine.org and two.example.machine.org, and I used a
RedirectMatch instruction matching ^/$ and pointing that to the
corresponding new URL.

This almost worked, but didn't work for some reason. The observed behavior
is that ALL URL's coming in to the virtual machine get redirected to the
new URL for the first virtual host, and the second (and any subsequent, as
per some testing) virtual host information, including the RedirectMatch
gets ignored.

Just for elimination purposes, I did test to see if Drupal multisite was
somehow acting as the culprit. It does not appear to be the case, as I
tried to point different name based VH's to different document roots. I
saw similar behavior, in that every URL going to that machine ended up at
the new doc root.

For further reference, the relevant (at least I think it's the relevant)
part of the /etc/apache2/apache2.conf file that did NOT work:

<VirtualHost one.example.machine.org>
DocumentRoot "/var/www"
<Directory "/var/www">
allow from all
Options +Indexes
</Directory>
RedirectMatch ^/$ "http://another.example.machine/one";
</VirtualHost>

<VirtualHost two.example.machine.org>
DocumentRoot "/var/www"
<Directory "/var/www">
allow from all
Options +Indexes
</Directory>
RedirectMatch ^/$ "http://another.example.machine/two";
</VirtualHost>

I've been banging my head against this for a while, and can't solve it
yet, so any help you can provide will be greatly appreciated.

Thanks all!
Josh





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux