I'm trying to create a development environment with .localhost as the FQDN.

I'm using Local by Flywheel which is basically MAMP, its a GUI which lets me create vagrant boxes. I can create a site such as example.dev and point it to my local IP address in the /etc/hosts file and it works great: example.dev 

And I can change it to something else like example.test and it still works great: example.test

If I change it to .localhost I get a 403 forbidden error. example.localhost

There are no other records in my /etc/hosts file. I'm trying to work out at what stage the domain is routed somewhere else.

What would prevent the localhost domain from mapping to the correct URL?

1 Answer 1


You can't. The localhost is already reserved as a Special-Use Domain Name (RFC 6761, 6.3).

The domain localhost. and any names falling within .localhost. are special in the following ways: - -

  1. Name resolution APIs and libraries SHOULD recognize localhost names as special and SHOULD always return the IP loopback address for address queries and negative responses for all other query types. Name resolution APIs SHOULD NOT send queries for localhost names to their configured caching DNS server(s).

You may have confused this with .local, widely used in private networks and reserved special-use domain name for Multicast DNS (mDNS) in RFC 6762. When using .local, try avoid resolving those names using global DNS. Using .local in Active Directory is a classic example of very bad implementation causing unnecessary queries to L root name server.

  • In summary, make up whatever .test you want, or register a domain and use that namespace, like wwwdev.example.com. Anything else may not work as expected in the DNS. Nov 6, 2017 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .