0

At work we have a series of aliases for websites like repositories etc. and they are used by typing something like open/repo in the browser.

I wanted to create something like this at my private PC and found out I could add a line to /etc/hosts file and it looks like this:

172.217.16.46 gl

Now what I would expect is to type gl in any browser and it would redirect me to google.com, but unfortunately I get 404 errors on every browser. The only answers I found were browser specific, like this one for Chrome, where other browsers actually work as expected.

What I tried:

  • I've run ipconfig /flushdns in cmd (on admin rights)
  • I put http:// before the alias in Chrome

Note: I would like to keep all the changes locally on my machine (without changing router configuration etc.)

Rasmond
  • 442
  • 4
  • 15

1 Answers1

0

If you are getting a 404 error, the problem is probably not that DNS resolution is failing but that your address is wrong. It sounds like you have tried to point gl to Google's IP. That would cause your request to hit Google's server, but Google will probably reject it since it is labeled addressed to gl instead of google.com in the HTTP request.

This phenomenon happens because it is common for web servers to host different websites on the same IP only with different domain names. I believe the term for these is "virtual host".

At any rate, try pointing to an IP that takes any name to access the website, or otherwise you are probably looking for some kind of redirect instead of A record DNS.

Grant
  • 442
  • 5
  • 19