Check out the Latest Articles:
Editing the hosts file in windows 7

Windows 7 has recently launched and, as with any operating system change, we have to learn new tricks. This happened to be when I tried to add a URL to the hosts.txt file so that it would redirect locally. This technique is used by web developers to make the process of editing and changing files quick and easy.

I have wamp server installed on my local machine and it acts as a web server so whenever I edit server side files I can see the result without needing to upload them. The way you access this is through a browser and by typing in localhost.

I also use an open source eCommerce package called Magento. If you install Magento on a your computer when you login to the admin panel is stores a cookie of information. The problem is localhost doesn’t allow for the system to store cookies, you need a domain suffix for this.

So what people have done in the past is add a line to the hosts.txt file that says 127.0.0.1 localhost.com – this means that localhost.com will route internally. In Windows 7 you can’t edit the hosts.txt file in the same way, you have to do the following:

Open the control panel and go to networking and sharing center, click “view network status and tasks”. Then choose change adapter settings and pick the local area connection – this is your default connection usually. In there you will see all the adapters that give you access to the internet. Choose the adapter that is called Internet Protocol V4 and choose properties. In the advanced setting there will be a tab called WINS, click that. You have to turn on Enable LMHOSTS lookup.

OK your way out of everything and go to the start menu – you need to open notepad as Adminstrator, otherwise you won’t be able to save the file you are going to edit. Then open C:\windows\system32\drivers\etc – you need to open LMHOSTS.sam.

Then you can add the 127.0.0.1 localhost.com line to the bottom of that file, save it and you are good to go. This will work with add domains that you want to redirect internally.



  1. It‘s quite in here! Why not leave a response?