Getting Started

Deployment Deployment - Diagnose Migrations Staging

Site Management

Backups Client Reporting Passwords Plugin Automation Plugin Management - Global Plugins & Themes - Diagnose Plugins & Themes - General Plugins & Themes - Git Plugins & Themes - Logs Must Install White Label WordPress Updates

Caching & Performance

Caching Caching - Blogs/Articles Caching - Diagnose Caching - Git Caching - WooCommerce Redis Optimize & Scale

Security

Security Security - Firewall

SMTP, CDN & DNS

SMTP SendGrid CDN CDN - AWS CDN - Cloudflare CDN - Diagnose Domains & DNS

Server & Tools

Analytics & Logs CRON Jobs Database Debug Tool Git Monitoring PHP Settings Redirects SEO Tools Server Errors sFTP SSL

Staq Billing

Staq Billing > Account Staq Billing > Client Staq Billing > Setup

Media

Media Media - Diagnose Media - Optimize

Accounts & Billing

Accounts & Billing

General

WordPress Hosting Website Diagnose Troubleshoot - Other

Accessing the Old Website or Server Using the Hosts File


On this page

    In some scenarios, you may need to access the old website or server while it is still operational. For example, you might want to:

    • Migrate data to the new site.
    • Download a backup from the old server.

    This guide explains how to temporarily edit your local computer’s hosts file to access the old server by pointing your domain to its old IP address.

    Step 1: Find the Old Server’s IP Address

    If you don’t already know the old server’s IP address, you can retrieve it using the following methods:

    • Check the DNS records for the domain using a third-party tool like SecurityTrails and look for the historical IP address under the A record’s Last Seen data.
    • Contact your previous hosting provider to request the old IP address.

    Step 2: Edit the Hosts File

    Once you have the old server’s IP address, follow the steps below to temporarily edit the hosts file on your local computer. This will allow your local machine to resolve the domain to the old server’s IP address.

    For Windows

    1. Open Notepad as an administrator:
      • Search for Notepad in the Start menu.
      • Right-click and select Run as Administrator.
    2. Navigate to the file path: C:\Windows\System32\drivers\etc.
    3. Open the hosts file in Notepad.
    4. Add the following line at the end of the file (replace [OLD_IP] and [DOMAIN] with the old server’s IP address and your domain name):
      [OLD_IP] [DOMAIN]
      

      Example:

      123.45.67.89 example.com
      
    5. Save the file and close Notepad.

    For Mac

    1. Open the Terminal application.
    2. Type the following command and press Enter to open the hosts file in the Nano editor:
      sudo nano /etc/hosts
    3. Enter your password when prompted.
    4. Add the following line at the end of the file (replace [OLD_IP] and [DOMAIN] with the old server’s IP address and your domain name):
      [OLD_IP] [DOMAIN]
      

      Example:

      123.45.67.89 example.com
      
    5. Press Control + X to save and exit.

    Step 3: Flush the DNS Cache

    After updating the hosts file, flush your DNS cache to ensure the changes take effect:

    For Windows

    1. Open Command Prompt as an administrator.
    2. Type the following command and press Enter:
      ipconfig /flushdns
    3. You should see a confirmation message that the DNS cache has been cleared.

    For Mac

    1. Open the Terminal application.
    2. Type the following command and press Enter:
      sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
    3. There won’t be a confirmation message, but the DNS cache will be cleared.

    Step 4: Access the Old Website

    Now, when you visit your domain in a browser (e.g., http://example.com), your local computer will resolve it to the old server’s IP address. You can migrate data, download backups, or perform any required operations.

    Step 5: Revert the Hosts File Changes

    Once you have finished accessing the old server, remove the entry from your hosts file to ensure your computer resolves the domain to the new server. Follow the same steps as above to open the hosts file and delete the added line:

    [OLD_IP] [DOMAIN]
    

    Save the file and flush the DNS cache again to finalize the changes.

    Conclusion

    Editing the hosts file is a temporary solution for accessing an old website or server. Ensure you revert the changes to avoid confusion or potential issues in the future.

    Need some help?

    We all do sometimes. Please reach out to our support team by dropping us a support ticket. We will respond fast.