How to Access Website without Domain Name Assigned
When you transfer a working website from one server to another, it is mandatory to test whether the site is working perfectly on the new server before updating the DNS records. Otherwise, your website may be not functional for a long time which affects on site performance. In this tutorial, we will guide you to transfer site from one server to another server without any interruption.
Basically, the website can be checked using the temporary URL (
http://server_ip/~cpanelusername/) on cPanel before switching DNS. But for security reason, many hosting providers don’t allow to access the website via server IP address or temporary URL. Due to this, mod_userdir is disabled and you don’t have permission to enable it on your shared hosting. However, there has another option to test your website before pointing domain name or update DNS records with the new server.
Using the Hosts file, you can map the hostnames to the IP address on your computer. It will help you to work on the new server with your domain name, and rest of the users will be pointed to the old server.
Follow the below steps to access the website without domain name assigned using server IP address.
- Open the “hosts” file in a text editor such as Notepad or Wordpad. The location of the “hosts” file will different for different operation system.
Linux or Ubuntu: /etc/hosts
Mac OS X: /private/etc/hosts
- Add the following lines at the end of the “hosts” file. Replace the “IP_Address” with your new server IP address and “domain_name.com” with your actual domain name.
IP_Address domain_name.com IP_Address www.domain_name.com
Note that: The server IP address can be found in the email received from your hosting provider on the purchase. Also, you’ll find the server IP in your hosting cPanel.
Now the specific IP will overriding actual domain name DNS and you will be able to access your website on new hosting server from your local computer. Once your website working properly on the new server, your can update the DNS records to point your domain to the new server. Following this way, the migration from one server to another will not be affected your website performance.