Hi Jim,
Thanks for the reply.
Actually, I had already stopped using Redirect due to the fact that some other local services call the site locally with no domain specified (i.e. using telnet). However, for simplicity in my example here, I still posted with Redirect in order to demonstrate what I was doing. In actuality, my catch all is the following,
<VirtualHost *:80>
ServerName mydomain.com
DocumentRoot /var/www/mysiteroot
RewriteEngine On
RewriteCond %{HTTP_HOST} !^$
RewriteRule (.*) [
mydomain.com$1...] [QSA,R=301,NS,L]
</VirtualHost>
This catches anything that has a domain defined but is not the www.com domain, and forwards it to the www.com domain.
This allows me to forward mydomain.com, mydomain.co.uk, mydomain.net, www.mydomain.co.uk, www.myalternativedomainname.com etc etc, without explicitly mentioning all the possibilities. As you may have guessed from this, I'm handling the default site at that IP address, so if anything comes through to the IP address that's not specifically matched by a VirtualHost, then it get's forwarded to the specified www.com domain. What I'm aiming at is to specifically match the hostname of the machine in a dynamic way and avoid this forwarding and thus the loadbalancer.
So far, I've got around this by specifying a ServerAlias for every machine name in my farm in main domain's VirtualHost definition, and then scp'ing this to all machines. It works, but it's not dynamic if I add a new machine, and it leaves a messy config.
I realise it's not a shell script, but I saw some similar dynamic content on this page
[
httpd.apache.org...]
using for example VirtualDocumentRoot /www/commercial/%0/docs
The thing is, I can't find out where %0 is defined, and what other options are available. I was hoping something might be available. Does this sound familiar?
Thanks
George