views:

15

answers:

0

We have discovered that there is an old DNS entry registered somewhere in the world that redirects some old domain name to our servers IP address. This other domain is not registered to us, but Google is indexing the content of that site (which is just the content of our site) and then marking our site's content as a duplicate of that site, thus affecting our search ranking and SEO campaign. I had initially solved this by making it so that the catch-all virtual host configured in Apache would just through a 404 for any host name not matching the other defined vhost entries. However, I have now discovered that that also prevents me from calling up the individual server (these are two mirrored servers behind a load balancer) by IP address alone, which I occasionally need to do to check server health or see if a change has been replicated. What I would prefer to have happen is to serve a particular vhost if the IP address alone is used (and the default port), but if a domain name is used other than those matching our other virtual hosts have the server send a 302 redirect to the real domain name. What is the best way to configure our vhost entries to do that? (I'd rather not use ModRewrite for this as we have a number of test/dev servers that I'd also have to take into account in any match rules, and which change frequently.)