Using Virtual Hosts on OSX to preview your site

Using Virtual Hosts on OSX to preview your site

From time to time, we might ask you to set up virtual hosts on your machine, so you can see the site before the world can. 

We 'trick' your browser into seeing the new site, while the rest of the world is still looking at the old one! It takes just a few minutes to do. 

On  OSX (Apple Mac) do this with the following steps:
1. Launch Terminal (find it using Spotlight search)
2. Copy/paste the following, and ENTER:
sudo nano /etc/hosts

3. Enter your OSX password

4. Copy/paste the line(s) given to you by Performance Foundry to the top of the file. You may need to hit "enter" to drop the ## to the next line. They'll look something like this:
### Virtual hosts ### XXX.XXX.XXX.XXX example.com www.example.com or like this:XXX.XXX.XXX.XXX subdomain.example.com

5. To save, hit CTRL + X
6. Hit Y
7. Hit ENTER

This should bring you back to where you started... the initial Terminal window with a cursor.

8. Type the following, and ENTER:
dscacheutil -flushcache
    • Related Articles

    • Editing your hosts file on Windows to preview your site

      From time to time, we might ask you to set up virtual hosts on your machine, so you can see a development site before the world can.  We 'trick' your browser into seeing the new site, while the rest of the world is still looking at the old one! It ...
    • Using Rich Pins from Pinterest

      What are they? If you use Pinterest, you know that adding a "pin" to an image can be cumbersome. To make things easier, Pinterest allows external sites to incorporate the "Pin it" function to their images, so that users can simply click on a button ...
    • My site doesn't look right!

      If your site isn't looking quite right, we'd love to get it back to normal for you. The first step is to check that the problem is visible to other visitors to the site, since some display issues are caused by problems with an internet connection or ...
    • How does caching work? ​What caching plugin am I using?

      Using caching is an important part of improving site speed, so all sites on Performance Foundry Managed WordPress Hosting have caching set up. We do this right at the server level, so no additional plugins are required. You might have noticed that we ...
    • What cookies is my site dropping?

      A cookie is a small file that holds a small amount of data about a specific user, and is stored on that user's computer. For example, if you're making a purchase and enter your contact details, that information will be stored in a cookie while you're ...