views:

1483

answers:

3

For local testing (and learning), I wish to use x.com host name instead of localhost. I changed my Windows XP host file to this -

127.0.0.1       x.com

Now http://x.com/ works beautifully but http://www.x.com doesn't. :(

What changes should I make so that www.x.com, sub1.x.com, sub2.x.com etc.. all work on local. WordpressMU will lets users create sub-domains dynamically.

I am basically trying to setup WordpressMU locally. I'm using Apache/2.2.4, PHP/5.2.4, and MySQL5.

Please help!

+2  A: 

You can repeat the same IP address several times to redirect multiple host names. You have to list the full host names though -- you can't list domain names or wildcards and expect all hosts in that domain to redirect to the IP address.

127.0.0.1 x.com
127.0.0.1 www.x.com
127.0.0.1 sub1.x.com
127.0.0.1 sub2.x.com
Oren Trutner
WordpressMU will let users create their own blogs on subdomains, I guess a dynamic solution would work well.
Arpit Tambi
+2  A: 

You can also put all the host names for an IP address on the same line:

127.0.0.1 x.com www.x.com sub1.x.com sub2.x.com

If you have a lot of sub-names, it would certainly be easier with a wildcard but unfortunately this is not supported with the hosts file.

Alternatively you could download the trial version of Simple DNS Plus which you can use to run a local DNS server on your XP machine (make sure to setup TCP/IP to use 127.0.0.1 for DNS). This allows you to setup wildcard entries like *.x.com.

Jesper
Using WordpressMU users can create their own sub-domains..
Arpit Tambi
+1  A: 

You should put localhost back, because there might be software that depends on that entry.

benc