

Hostname – usually, this is the domain name that you want to map to the associated IP address.IP Address – this is the IP address of the server that you want to map a domain to.How The hosts File Works At A Basic Level Then, we’ll also share a beginner-friendly tool that lets you preview your website on a new server before DNS propagates without the need to edit your hosts file, though it’s not quite as flexible as editing your hosts file. That means you’ll be able to fully test out your new site without needing to wait for your DNS changes to propagate. The hosts file lets you fix that by manually mapping your site’s domain name to the IP address of your site’s new server. However, DNS takes some time to update, which means that your domain name might still take you to Host A when you really want to end up at Host B to see if your newly migrated site is working properly. Then, you’ll need to update your domain’s nameservers to point to Host B ( instead of Host A). For example, if you move from Host A to Host B, you’ll first migrate all of your site’s files. However, the hosts file provides an alternative method to map hostnames to IP addresses without using DNS.Īs a WordPress user, the hosts file can be especially helpful when you migrate a WordPress site to a new host or otherwise change your domain’s nameservers.

Normally, this process is handled by the Domain Name System (DNS) when you’re using the Internet. In practical terms, that means that it maps a domain, like, to a server’s IP address, like 192.168.0.1. Your computer’s hosts file is a simple text file that maps hostnames to IP addresses.
