0

Half a year ago I installed XAMPP on my Computer with a few virtualhosts ending with ".dev". When I now try to open those websites in Chrome it gives me the error ICANN Name Collision. After some research I found out that im not the only one with the Problem and that the only way around is to Change to ".local".

So I changed my Host File and httpd.config restarted the System/FLushed the DNS Cache but it's not working anymore. I can't acces the Server with the new local Domain names. When I use IE and type in example.dev (or whatever adresse i used before) it still redirects to localhost but not to the old Directory. Therefore I guess that Apache noticed the Change and is on the new configuration but my Browser somehow tell me they can't find the Server.

What is the most likely Error? Which Error Logs might be helpful?

If I use the XAMPP/Apache Shell and type in httpd -S it prints me out the current v-Host Settings like in the v-host.config file.

Host File:

127.0.0.1 db.local

127.0.0.1 test.local

127.0.0.1 www.test.local

127.0.0.1 host.local

127.0.0.1 www.host.local

apache\conf\extra\httpd-vhosts.conf:

<VirtualHost *:80>
    ServerName localhost
    ServerAlias localhost
    DocumentRoot "C:/XAMPP_DEV/htdocs"
</VirtualHost>
<VirtualHost *:80>
    ServerName db.local
    DocumentRoot "C:/XAMPP_DEV/phpmyadmin"
</VirtualHost>
<VirtualHost *:80>
    ServerName test.local
    ServerAlias www.test.local
    DocumentRoot "C:/XAMPP_DEV/htdocs/test"
</VirtualHost>
<VirtualHost *:80>
    ServerName host.local
    ServerAlias www.host.local
    DocumentRoot "C:/XAMPP_DEV/htdocs"
</VirtualHost>

Thats my V-Host Configurtion and Host file; I removed all the lines starting with #.

j_s_stack
  • 667
  • 1
  • 5
  • 18
  • Clear your browser cache or make a "deep reload". This might also be a typo in your http servers host configuration which causes the server to fall back top the default host. This happens if the host specified in the request cannot be found internally. Triple check your configuration or post the relevant parts here. – arkascha Jul 04 '15 at 04:54
  • i cleared chrome under: chrome://net-internals/#dns and IE aswell in´the Settings no Change :/ – j_s_stack Jul 04 '15 at 04:57
  • if I ping to "example.dev" I get all packets back and it showes me the IP 127.0.53.3 – j_s_stack Jul 04 '15 at 04:59
  • 1
    `ping` is mostly worthless for debugging purposes. You already said before that the host actually _is_ resolved to your local http server (if I understood correctly), so there is no new information here. Question is if the http server knows the host you refer to. Note: host != address – arkascha Jul 04 '15 at 05:01
  • Ok How can I find out if the http Server knows the host? – j_s_stack Jul 04 '15 at 05:02
  • As written in my first comment: triple check the host configuration, you said in your question that you checked it. Maybe you have a typo somewhere. You also may want to post the configuration here along with your `/etc/hosts` file. – arkascha Jul 04 '15 at 05:03
  • Ok see my edit. Did I miss anything? – j_s_stack Jul 04 '15 at 05:16
  • Why is example.dev resolved to `127.0.53.3` when the host file contains only entries pointing to `127.0.0.1`? Also if I understood correctly you do _not_ use the `.dev` TLD any more. The files look fine so far. – arkascha Jul 04 '15 at 05:20
  • Yes I removed the *.dev* and replaced it with *.local* without making any other changes. And I dont know why it's resolved to that adress? – j_s_stack Jul 04 '15 at 05:24
  • So just to get this clear: you did _not_ ping `example.dev` as you wrote above but one of the host names in the `/etc/hosts` file, samke in the browser? So `host.local` for example? And the url in the browser does not change? Then you should go on checking your http servers log files, specifically the access and the error log. Also make sure you have no rewriting rules that still refer to the older `.dev` host definitions. – arkascha Jul 04 '15 at 05:28

1 Answers1

0

Intro..

It's an old question that came to me because I was looking into something very similar. But happens that I know the answer just not how to apply it to an Android phone I do not want to "root". Anyway.. I don't know if it will help you - probably not as you might have solved already - but it can help others.

Just explaining: .dev became a new gTLD. So, some people own these domains.

You can't have a fixed IP pointing to it - security and legal reasons. That's why your browser don't recognize it - the DNS servers of you internet provider (or you chosen DNS servers) actually.

BUT..

There is a way. You don't have to use .local.

Local browsers will recognize it if your hosts file (the system file, not the server file with similar name) point to the local machine that hosts the website. Or if you local DNS server points that address to your local machine or server. Both scenarios will enforce the IP provided by you.

Most developers won't be using a DNS server. I will take it for granted because if you have a DNS server, you probably know more than I do (which isn't something very difficult to accomplish.. :) and wouldn't, probably, be having these issues.

Fixing it..

Assuming you have the same configuration as you previously had - with .dev - you simply can go to your computer (or every computer in the local network - depends on your case) and edit C:\Windows\System32\drivers\etc\hosts file under Windows. The same for Linux would be under /etc/hosts.

You can put at the end of the file:

IP_OF_THE_MACHINE    yourfakedomain.dev

IP_OF_THE_MACHINE will simply be the IP of the 'host' of the page being developed:

  • Assuming only you will be seeing it, use 127.0.0.1;
  • Assuming your friend/boss have the need to check the current status of what you are developing, edit this file in his computer and put you machine IP address and the fake domain for local development. This assumes that they are in the same network;
  • Assuming that you'll be the one using it but have the host at other PC, put that PC IP address (like the case above).

yourfakedomain.dev I think it is self-explanatory..

( Should not be an issue but I would change those * to the fake domain name you will use, like from <VirtualHost *:80> to <VirtualHost test.dev:80>. Of course, the proper name for each case. )

Try this and check the result. Should be all functional.

Notes..

You always have to edit at least three files:

  • a virtual host file - being it divided into several separated files or under one (like httpd-vhosts.conf);
  • the httpd.conf to select the IP and port range AND to include the virtual hosts file (or files);
  • the hosts file of you system to enforce things like 'fake domain names' (test.dev, mymon.is.cool, hi.world.. etc - use your imagination);

It should always work with this. Unless you have conflicts with older or bad configurations (remove configuration files and uninstall everything; reinstall and start afresh) or something with your router.

José
  • 354
  • 5
  • 18