Working With The HOSTS File

From The Uniform Server Wiki
Jump to navigation Jump to search

Modifying the HOSTS file on your computer will allow you to use the VirtualHost tool to run multiple development servers at the same time, without having to restart the server each time.

Suggested Setup

Suppose we create virtual hosts based off localhost, so we'll have the main domain, localhost and the subdomains example.localhost, test.localhost, and foobar.localhost. These have been setup properly in the httpd.conf file, however until the HOSTS file is configured properly. Navigate to your HOSTS file (normally in C:\WINDOWS\System32\drivers\etc\HOSTS) and add the following lines: example.localhost 127.0.0.1 test.localhost 127.0.0.1 foobar.localhost 127.0.0.1 Now those subdomains will point to the Virtual Host on your server.

Using .bat Files to Update HOSTS automatically

Coming soon...