I am trying to set up a domain on my development machine so that I cant test slightly more complex htaccess rules. I am trying to set up example.city domain. Following what I find by googling, I have done the following:

Windows hosts file Windows/System32/drivers/etc   example.city   www.example.city   localhost

And I have flushed the DNS cache more than 20 times by now by using

ipconfig /flushdns

When I ping example.city, I get the following, so I am confident that this part is fine.

Reply from bytes=32 time<1ms TTL=128

Next I set up the httpd-vhosts/conf file in xampp/apache/conf/extra

<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot "F:/xampp/htdocs/city"
  ServerName example.city
  ServerAlias *.example.city
  ErrorLog "logs/example.city-error.log"
  CustomLog "logs/example.city-access.log" common
  <Directory />
    Options FollowSymLinks
    AllowOverride All
    Require all granted

<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot "F:/xampp/htdocs"
  ServerName localhost
  ServerAlias *.localhost

I stopped and started apache.

When I type in localhost/city in the browser it executes the html there.

I have flushed the browser cache and tried 2 different browsers. When I type in example.city or http://example.city, I get the following

This site can’t be reached

The webpage at http://example.city/ might be temporarily down or it may have moved permanently to a new web address.


The two error logs files got created but are blank.

Am I not allowed to do this? Or have I missed a step?

  • If you're using XAMPP then your title is wrong, as it's not a Windows Server. Secondly, that's a configuration issue. Your computer is pinging the right address, but XAMPP isn't configured correctly to handle the URL. Commented Feb 5, 2022 at 9:58
  • @GeoffAtkins XAMPP is available for Windows, Linux and macOS.
    – MrWhite
    Commented Feb 5, 2022 at 11:11
  • 1
    Check the network traffic in the browser when making this request to get more detail... what IP is the browser trying to connect to?
    – MrWhite
    Commented Feb 6, 2022 at 18:15
  • 3
    Aside: Your <VirtualHost> doesn't appear to be set up quite right (although not the cause of your immediate problem). I would think DocumentRoot "F:/xampp/htdocs" should be DocumentRoot "F:/xampp/htdocs/city", to avoid having to specify the /city subdirectory. And you should never be overriding <Directory /> here. This should reference the document root. eg. <Directory "F:/xampp/htdocs/city">.
    – MrWhite
    Commented Feb 6, 2022 at 18:16
  • 1
    Don't use arbitrary domain names or TLDs. Either use TLDs specifically set aside as private, such as .example. Or register once for all a real domain name, in any TLD (do note however some of them like .dev do have requirements about certificates for HTTP, etc.) and then use it as suffix for any of your local needs. Commented Feb 7, 2022 at 10:05

1 Answer 1


The browser that you are using to test likely has DNS over HTTPS (DoH) enabled. That is a feature where the browser ignores the local DNS settings and instead looks up DNS from its own internet provider. This causes your browser to ignore any DNS overrides made through your local hosts file. The solution is going to be to disable this browser feature in all the browsers with which you are testing.


Open chrome://settings/security and turn off "Use secure DNS."

After changing this setting you may also have to clear your cache from chrome://settings/clearBrowserData by choosing to "Clear browsing data" for "All time" and choosing "Cached images and Files"


Go into the menu then "settings" then "general", and scroll to "Network Settings" and click "Settings..." Scroll down to "Enable DNS over HTTPS" and uncheck the box. (source)

  • Firefox now works. But curiously on both Chrome and therefore Brave, I cant find "Secure DNS Lookups" flag. Search does not find it and I have scrolled through them to look for similar names. Bummer, because I am using Chrome for debugging, so I can flush the cache constantly without affecting my browsing. I see on googlesupport that people have been complaining in 2020 that it doesnt exist. At least it proves that my config is ok. I might just get a raspberry pi and try and set it up on that. Commented Feb 10, 2022 at 10:09
  • 1
    I updated the Chrome instructions after testing it myself. I searched for "DNS" in settings. It is now called "Use secure DNS" Commented Feb 10, 2022 at 10:14
  • Cant "Use Secure DNS" either. I am normally up with my updates. My chrome version is 980.4758.82. I just checked, its the latest. The only other thing I found when googling, was that its disabled in "Managed Browsers", whatever that means. Commented Feb 10, 2022 at 10:21
  • I looked in chrome policies. and "DnsOverHttpsMode" is not set and its value is null. Commented Feb 10, 2022 at 10:26
  • On StackOverflow: Google Chrome Ignoring Hosts File. One answer suggest clearing the cache, another suggests using .local domains for testing for which Chrome evidentially always consults your local hosts file. Commented Feb 10, 2022 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.