Virtual Hosts killing localhost?

I’m a bit of a newbie, so apologies if I’m doing something incredibly stupid.

I’m setting up a couple of virtual hosts. Both of them work properly, but now typing ‘localhost’ into a browser brings up the last virtual host instead of the contents of /srv/www/htdocs.

My proceedure was to modify a copy of vhost.template in /etc/apache2/vhosts.d for each virtual host and add a line in /etc/hosts for each one: localhost ← already there sandbox ← new family.sandbox ← new

What am I doing that I shouldn’t be doing, or not doing that I should be doing?

You can put an entry in /etc/hosts telling any or each computer on the local lan where the apache server is – IF other name resolution aren’t in place. It’s a good quick fix for a local server.

But you use the IP address of the server, not the localhost address. So the entry is like this: family.sandbox

What if the server, which is in fact the localhost machine, does not have a fixed IP?

It’s a server, so you should give it a fixed IP.
You can do that in Yast –> network devices –> network settings –> edit –> sdtatically assigned IP. Plus specify also the IPs of the name resolvers of your ISP and the gateway IP address.
FFI and pics about the static IP, see this tutorial: HowTo Configure a network card in Suse/openSUSE 10, 11 for LAN and Internet Access.