How to Preview Your WPCloud Website Using the Hosts File Method
Using the Hosts File Method
Overview
The hosts file method is the professional standard for previewing websites before DNS changes. This guide explains how to safely view your website on WPCloud servers before updating your DNS records. This is the same method our migration team uses, ensuring 100% accuracy in preview testing.
Why We Use This Method: Unlike temporary domain names, which require URL rewriting and can't perfectly replicate your site's configuration, the hosts file method shows you exactly how your website will appear after the DNS change.
Prerequisites
- Administrator/root access to your computer
- Your website's new IP address (provided by WPCloud)
- Your domain name(s)
- Text editor (Notepad for Windows, Terminal for macOS)
Important Safety Notes
⚠️ Before You Begin:
- Back up your existing hosts file
- Make note of any changes you make
- Follow instructions exactly as written
- Keep track of which domains you've added
Detailed Instructions
Windows 10/11 Instructions
- Open Notepad as Administrator
- Press Windows key
- Type "Notepad"
- Right-click on Notepad
- Select "Run as administrator"
- Click "Yes" if prompted
- Access the Hosts File
- Click File > Open
- Navigate to C:\Windows\System32\drivers\etc\
- Change "File type" dropdown to "All Files (.)"
- Select "hosts" file
File Location: C:\\Windows\\System32\\drivers\\etc\\hosts
- Modify the Hosts File
- Scroll to the bottom of the file
- Add your new entry in this format:
- Example:
[WPCloud_IP] [domain.com] [www.domain.com]
192.168.1.1 example.com www.example.com
- Save Changes
- Click File > Save
- If you get a permission error, ensure you opened Notepad as administrator
- Flush DNS Cache
- Press Windows key
- Type "cmd"
- Right-click "Command Prompt"
- Select "Run as administrator"
- Type the following command:
- You should see: "Successfully flushed the DNS Resolver Cache"
ipconfig /flushdns
macOS Instructions
- Open Terminal
- Press
Command + Space
- Type "Terminal"
- Press Enter
- Access the Hosts File
- Enter your administrator password when prompted
- Note: You won't see the password as you type
sudo nano /private/etc/hosts
- Modify the Hosts File
- Use arrow keys to move to the end of the file
- Add your new entry in this format:
- Example:
[WPCloud_IP] [domain.com] [www.domain.com]
192.168.1.1 example.com www.example.com
- Save Changes
- Press
Control + X
- Press
Y
to confirm - Press
Enter
to save
- Flush DNS Cache
# For macOS 12 (Monterey) and later:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
# For macOS 10.10.4 through 11:
sudo killall -HUP mDNSResponder
Verifying Your Website
Primary Verification Method
- Clear Browser Cache
- Chrome: Press
Ctrl + Shift + Delete
(Windows) orCommand + Shift + Delete
(macOS) - Select "Clear data"
- Access Your Website
- Open a new browser window
- Enter your domain name with HTTPS:
<https://yourdomain.com>
- WPCloud Verification
- Add "/wpc.html" to your domain:
<https://yourdomain.com/wpc.html>
Success: If you see the WPCloud verification page, you're viewing the correct server Failure: If you get a 404 error, you may still be viewing the old server
Troubleshooting
Common Issues and Solutions
- Browser Still Shows Old Site
- Clear browser cache completely
- Try incognito/private browsing mode
- Try a different browser
- HTTPS Certificate Warnings
- Expected behavior - proceed to site
- SSL will work properly after DNS change
- Firefox-Specific Issues
- Open
about:config
- Search for
network.dns.offline-localhost
- Set to
false
- Alternative: Use Chrome or Edge for testing
- Permission Errors
- Ensure you're using administrator privileges
- Check file permissions
- Verify no other programs are editing the hosts file
Best Practices
- Document Your Changes
# WPCloud Testing - Added [Date]
192.168.1.1 domain.com www.domain.com
- Temporary Changes Only
- Remove entries after testing
- Keep a backup of original hosts file
- Multiple Domains
- Add each domain on a new line
- Include both www and non-www versions
Cleanup Process
- Remove Test Entries
- Follow access steps above
- Delete or comment out (#) added lines
- Save file
- Flush DNS again
- Verify Removal
- Clear browser cache
- Confirm site resolves to original server
Professional Tips
Why Not Use Temporary Domains?
Remember: This method is used by WPCloud's professional migration team and is the most reliable way to preview your site before DNS changes.
Did this answer your question?
😞
😐
🤩
Last updated on November 15, 2024