Create your virtual local domain names

Leave a comment
hosts file screen shot

You have any kind of web server application that runs on your local machine and you need to have local domains that works on that web server to create accessible virtual hosts locally.

The secret here is found in almost any operating system file called hosts file. It has the same name in almost all OSs i.e. hosts without any extension. However the path in which that file does exist is varied.

For example, in Linux and all Unix based OS, it found in /etc/hosts while in Windows, it probably found in C:\Windows\system32\hosts

The code that you have to insert in order to create a virtual local domain is just to add a line started with any local loop IP such as,, etc. followed by any domain name you prefer, just like the above screen shot. However, to prevent any accessibility issues, it is better to void choosing popular domain or common top level domains such as .com, .net,, etc. The best practice here is to make them atomic values such as mydomain.loc, domain.local,, etc.

Leave a Reply

Your email address will not be published. Required fields are marked *