How to resolve all .dev domains to localhost on Windows
Do you have a .dev zone in DNS already? You can create a wildcard entry where *.dev goes to the loopback.
Alternative: get your devs to just append .localtest.me, which is a public DNS zone that already exists (with a * A record) for this purpose.
I have resolved this situation using Acrylic DNS Proxy. It's a free, open-source software for Windows that allows you to wildcard a folder as local top domain registry.
- Download Acrylic DNS Proxy here: http://mayakron.altervista.org/wikibase/show.php?id=AcrylicHome
- Configure your Network settings to point to your local IP address as explained here: http://mayakron.altervista.org/wikibase/show.php?id=AcrylicWindows10Configuration
- Open your Acrylic config file here: Start > Programs > Acrylic DNS Proxy > Edit Custom Hosts File (AcrylicHosts.txt)
-
Add your wildcarded top level domain like this:
127.0.0.1 *.dev
- Restart Acrylic like this: Start > Programs > Acrylic DNS Proxy > Restart Acrylic Service
- Add the wildcard to your Apache config file. It may look similar to this:
It may look similar to this:
LoadModule vhost_alias_module modules/mod_vhost_alias.so
NameVirtualHost *.dev:80
<Directory "/www/sites">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *.dev:80>
VirtualDocumentRoot c:/www/sites/%-1/%-2+/
</VirtualHost>
That should do the trick.
I can recommend http://localhost.tv - all subdomains resolve to 127.0.0.1