I know how to resolve a hostname to an IP address using my hosts file eg
1.2.3.4 example.com
but is it possible to resolve a hostname to another
example.com example1.com
with a hosts file? Reason being, Im testing a new site, hosting uses Virtual hosts, so there are multiple domains on the IP address. ServerAlias in Apache is not an option either.
Any help appreciated!
Thanks Stephen
No.
You can add multiple hostnames to the hostfile, for example: 1.2.3.4 hostname1 hostname2
But every time you look up a name or address, youll just get the whole line back. Or was that what you wanted?
You can't resolve one domain to another, but you can have multiple hostnames for one IP like this:
1.2.3.4 example.com
1.2.3.4 example1.com
1.2.3.4 example.net
1.2.3.4 example.net
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With