Menu

Preview a site on its live domain

Updated on September 3rd, 2024

When preparing a site for launch, it can often be useful to test the site on the Flywheel server and live domain prior to making any DNS changes. This is possible by editing your hosts file.

Editing your hosts file allows you to point a domain to a specific IP address on your personal computer only. In particular, this method is often used when testing large multisites, as it’s far less error prone than swapping to temporary domains throughout your entire database.

Warning

Hey there! This help doc should be approached with caution. Only make changes to your hosts file if we’ve told you to make those changes or if you’re absolutely sure this is what you’re supposed to be doing.


Step 1: Verify your domain with the TXT record

Before you begin, you’ll need to verify your domain using a text record (TXT record).

A TXT record is used to verify that you own and control your domain, and prevents unauthorized use of it.

Follow these steps to verify your domain:

  1. Log in to the Flywheel app and select the website you’d like to preview.
  2. Click the 3-dot menu next to the domain and select Update DNS.
  3. 3-dot menu with DNS Details in the Flywheel app

  4. On the next screen, locate the TXT record for the domain. You will need to copy both values (Host/Label and Destination/Target).
    TXT record in the Flywheel app
  5. Log in to your DNS provider’s admin panel and locate the DNS editor. Contact your DNS provider if you’re not sure where to find it.
  6. Paste the TXT record values into the DNS editor. Contact your DNS provider if you’re not sure how to add the TXT record.

Note


You only need to enter the TXT record to preview your site on the live domain. Do not add the A or CNAME records yet. That step comes when you’re ready to go live.

Step 2: Locate your hosts file

All operating systems have a way to accomplish this task, but the process  and syntax is slightly different in each OS. You can find instructions here for specific operating systems.

hostsfile-mac

Note

Using a Mac? Try the app Gas Mask – you can even create multiple host files and switch between them.


Step 3: Modify your hosts file

When you’ve located your hosts file, you’ll need to add at least two pieces of information: the IP address you want the site to resolve to and the domain.

For example, adding the below two lines will point www.domain.com and domain.com to the IP address 173.255.230.60. You’ll obviously want to add your live site’s domain name, and the IP address of your new Flywheel server. These entries are separated in your hosts file only by a single space.

Flywheel IP Address Your domain name
174.255.230.60 www.domain.com
174.255.230.60 domain.com

hostsfile-edited-mac


Step 4: Set your primary domain in Flywheel

Once you’ve modified your hosts file, you’ll need to prepare your Flywheel site to work with the domain you added to your hosts file. You can learn about setting your Primary domain name here. Make sure you add the domain exactly as you added it to your hosts file previously – they should match.


Step 5: Save and test

Once you’ve added the proper domain and IP information as noted above, you can save the file and visit the domain in your browser. It should now load like normal, but from the Flywheel server – not your current host. Once you’ve completed your testing, you should remove these modifications from your hosts file.

Note

These changes only affect your local computer – not any visitors over the internet.

Need help?

If you have any questions our Happiness Engineers are here to help!

Was this article helpful?

Getting Started

New to Flywheel? Start here, we've got all the information you'll need to get started and launch your first site!

View all

Account Management

Learn all about managing your Flywheel user account, Teams and integrations.

View all

Billing

Everything about billing, invoices and payments can be found here.

View all

Features

Flywheel hosting plans include a ton of great features. Learn about how to get a free SSL certificate, set up a staging site, and more!

View all

Platform Info

All the server and setting info you'll need to help you get the most out of your Flywheel hosting plan!

View all

Site Management

Tips and tricks for managing your sites on Flywheel, including going live, troubleshooting issues and migrating or cloning sites.

View all

Developer Hub

Learn how to connect, deploy, and more with SSH on Flywheel's platform.

View all

Growth Suite

Learn more about Growth Suite, our all-in-one solution for freelancers and agencies to grow more quickly and predictably.

View all

Managed Plugin Updates

Learn more about Managed Plugin Updates, and how you can keep your sites up to date, and extra safe.

View all

 

Flywheel help

Help is just a click away! Log into Flywheel dashboard to instantly chat with an expert, respond to a ticket, or follow along with in-depth documentation. We happily offer support 24 hours a day, 7 days a week, 365 days a year!

Log in

Try Flywheel today

Launch your next site on WordPress in minutes.

 Free migrations  24/7/365 support  14 day demo sites