Forum Moderators: phranque

Message Too Old, No Replies

IP Based Virtual Hosts

Serving on multiple IPs

         

AllanS

4:01 pm on Jul 2, 2008 (gmt 0)

10+ Year Member



Hi,

I have two domains both pointing to a particular IP address. My machine runs Apache 2.2.3 and Debian. The set up I need is for apache to serve www.domain1.com and from that IP address and for www.domain2.com to 301 to www.domain2.com.

So I set up an IP based virtual host for www.domain1.com but I noticed that if I request www.domain2.com it will server www.domain1.com (presumably becuase domain2.com is associated with that IP address) however this is proper dodge as it is possible for any one to point their domain towards my webserver and for the webserver to server the the content in the documentroot for domiain1.

Ofcourse this is bad due to dupe content as it server it under the other domains name.

Anyone know how to stop this happeneing?

Cheers

Al

jdMorgan

7:59 pm on Jul 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure why you mentioned "multiple IPs" in the thread title. It sound like you should be using name-based virtual hosts, with one vhost for each domain and possibly a third one as a default server if you want to 'catch' and handle spurious domain requests in some special way.

See the Apache 2.2 Virtual Hosts tutorials [httpd.apache.org] at apache.org for more info.

Jim