Let’s say you have your current web site on Hosting Company X, but you want to build a new WordPress site on a better server at Hosting Company Y. Sure you can go into cPanel and easily do the initial installation of WordPress, but you can’t log into it because yourdomainname.com is still pointing to Hosting Company X, and WordPress will try to redirect any other aliases you’ve used that it’s not specifically configured for.
How can we work around this, and get the new site ready without interfering with the current site?
The Hosts file!
It’s a plain text file that exists in Windows, Mac OS, and Linux.
Mac OS: /private/etc/hosts
Simply open the file with Notepad (or similar), and add a line for yourdomainname.com with your new server’s IP address, provided by Hosting Company Y. For instance:
184.108.40.206 yourdomainname.com www.yourdomainname.com
Once you’re done testing, remove that line and make your name server changes.