How to check your site with temporary DNS method
Introduction
Before updating a domain’s DNS records or migrating a website to a new server, it is important to verify that the website is functioning correctly on the destination server. This helps identify issues related to website files, database connections, SSL certificates, or server configuration before the DNS propagation begins.
There are two commonly used methods to preview a website on a new server:
- Using a Temporary URL
- Using a Temporary DNS Entry via the Hosts File
Prerequisites
Before testing the website from the new server, ensure the following:
- The website files have been migrated successfully
- Databases have been imported correctly
- The domain is configured on the new server
- You have the new server IP address
- Administrative access to your local computer to edit the hosts file
Implementation
Method 1: Using Temporary URL
You can access the website temporarily using the server IP address and cPanel username.
Format:
http://IPaddress/~username
Example
http://192.168.1.10/~exampleuser
Limitations
Using a temporary URL may not fully load the website correctly because:
- CSS or images may not display properly
- Database connections may fail
- CMS applications like WordPress may redirect incorrectly
- SSL certificates will not function correctly
Due to these limitations, this method is generally recommended only for basic checks.
Method 2: Using Temporary DNS (Recommended)
This is the preferred and most reliable method for testing websites before DNS changes.
The process works by editing your local system’s hosts file and mapping the domain name to the new server IP address.
Step 1: Add Entry to Hosts File
Add the following line to the hosts file:
xxx.xxx.xxx.xxx domain.tld www.domain.tld
Replace:
xxx.xxx.xxx.xxxwith the new server IP addressdomain.tldwith your actual domain name
Example
192.168.1.10 example.com www.example.com
Hosts File Locations
Linux / UNIX
/etc/hosts
Windows
C:\WINDOWS\system32\drivers\etc\hosts
macOS
/private/etc/hosts
Step 2: Save the File
After adding the entry, save the hosts file.
Note: Administrator or root privileges are required to edit this file.
Step 3: Clear DNS Cache (Optional but Recommended)
Windows
ipconfig /flushdns
Linux
systemctl restart NetworkManager
macOS
sudo dscacheutil -flushcache
Step 4: Test the Website
Open your browser and access the website normally:
http://domain.tld
or
https://domain.tld
Your computer will now load the website from the new server instead of the old server.
Verify the following:
- Website pages load correctly
- Images and CSS display properly
- Database-driven content works
- Admin panel login functions
- SSL certificate is working
- Emails and forms function correctly
Conclusion
Testing a website before DNS propagation is an important step during website migration or server changes. While temporary URLs can be useful for quick checks, modifying the local hosts file provides the most accurate preview of how the website will behave after the DNS update.
Using the temporary DNS method allows administrators to safely verify website functionality, reduce downtime, and ensure a smooth migration experience before making the website live on the new server.
