Skip to content

Back

How to edit your host file on Windows

Applies to:
Domains
Professional Hosting
Universal Hosting
Reseller Hosting
VPS Hosting
WordPress Hosting

Difficulty:
Easy

Time Needed:
5 minutes

Introduction

This is a quick step-by-step guide to editing your host file on Windows. Editing your host file is a great way of viewing a specific web server prior to updating your DNS, or whilst it is propagating.

If you are a Mac user, please see our Knowledge Base article ‘How to edit your host file on macOS’.


How to edit a host file on Windows

STEP 1
Click on the ‘Start’ button

When running Windows, click on the start button (or the Windows icon), usually located at the bottom left of the screen.


STEP 2

Choose ‘All Apps’

On the start menu, choose ‘All Apps’ from the list of options. Then click on the option labelled ‘Windows Accessories’


STEP 3
Select ‘Notepad’

After you have clicked on ‘Windows Accessories’, you will be presented with a list of applications. Locate ‘Notepad’ from the list of icons, and right click on it. Then choose ‘Run as administrator’ from the context menu.

At this point a dialog box may open, asking you ‘Do you want to allow the following program to make changes to this computer’. Simply click ‘Yes’ to proceed.


STEP 4
Open the host file

In Notepad, click ‘File’, then ‘Open’.


STEP 5
Locate your host file

From the window that opens, click on ‘Text Documents (*.txt)’ and choose ‘All files’. Then locate and open the following file:

c:\Windows\System32\Drivers\etc\hosts


STEP 6
Edit the host file

This will open your host file. To add a new server or domain, move the cursor to the bottom of the file, then enter the IP address of your server, press the ‘Tab’ key, then enter your domain name.

The following is an example, you will need to update these to your relevant IP address and URL.

127.0.0.1 yourdomain.com

When you have entered the relevant IP address and url, click ‘File’, then ‘Save’ to save your changes.

Then open your web browser and enter the domain you added to your host file. If the site changes from the one of the public can see, to the one on your new server, then you have edited the host file successfully.

Was this article helpful?
YesNo