Knowledge Base

Preview Your Site Without Changing DNS

You can add your domain name(s) to your hosts file (circumvent DNS) by doing the following for all local computers:

Note: please remember to remove the entry you added (and ONLY that entry; your computer may not work correctly if you remove all entries!) when you're done testing. This will avoid problems down the road if your account is migrated, assigned a dedicated IP, etc.

Linux (i.e. Ubuntu)

  1. Open an xterm (or any other terminal emulator of your choice)

  2. Type in: sudo nano /etc/hosts (or use any other editor of your choice, such as my personal favorite, vim (hit i to edit text in vim); just be sure to edit the file with root privileges)

  3. Add a line containing xx.xx.xx.xx yourURL.com, where xx.xx.xx.xx is the appropriate IP address for the A Small Orange server, VPS, etc. (this will most likely be the main shared IP unless you have purchased a dedicated IP) and yourURL.com is your actual domain or subdomain hosted on that server (do not insert slashes, http://, or the like)

  4. When done, save the document (use CTRL+X to save and exit, which you must confirm by hitting the y key in nano; vi(m) users would hit Esc then :wq)

  5. You should now be able to visit yourURL.com in a web browser and be able to see the content you have hosted on our servers

To remove the entry...

  1. Follow steps 1 and 2 above

  2. Remove the entry you added (in nano, move the cursor down to the entry and hit CTRL+K to delete the line; in vi(m), move the cursor to the line and hit dd)

  3. Save the document (see Step 3 above for instructions on how to do that)

You're done!


By default, if you try to modify your hosts file in Vista or Windows 7 it will not let you save it. It tells you that you don't have permission. To successfully modify the hosts file, run notepad.exe as an administrator and open the file.

  1. Browse to Start, then All Programs, then Accessories

  2. Right-click Notepad, then select Run as Administrator

  3. Click Continue on the UAC prompt
    Note: this prompt will only appear if UAC is enabled.

  4. Click File, then Open

  5. Browse to C:\\Windows\System32\Drivers\etc

  6. Change the file filter dropdown box from Text Documents (*.txt) to All Files (*.*)

  7. Select Hosts and then click Open

  8. Add an entry like this: xxx.xxx.xxx.xxx yourURL.com (see Step 3 under the Linux instructions for details)

  9. Save your host's file

  10. Enter http://yourURL.com in the address bar of your web browser and press Enter

    Because the host's file will tell your computer to check a different IP address for your site, you can now preview your site as it is served from our server.

To remove the entry...

  1. Follow steps 1-7 above

  2. Delete the line you had added

  3. Save the file

Mac OS X

  1. Open a terminal by going to Applications, then Utilities, then Terminal

  2. Type in: sudo su -

  3. Press Enter

  4. Type in: echo "xxx.xxx.xxx.xxx yourURL.com" >> /private/etc/hosts (see Step 3 under the Linux instructions for details)

  5. Press Enter and you're done

To remove the entry...

  1. Follow steps 1-3 above

  2. Type in vi /private/etc/hosts

  3. Press Enter

  4. Use the cursor keys to position the cursor over the line you added above and type dd to delete the line

  5. Type :wq to save your changes and exit

Did you find this article helpful?

* Your feedback is too short