0

I was wondering if I could use my Windows 7 hosts file to create shorter URLs for sites? OR is there another way. I tried ones like the following but I'm guessing it only works with IP Addresses?

http://www.google.com goog

OR

http://www.google.com goog.le (didn't really use this just another example)

1
  • 2
    Is this so you don't have to type so much? Modern browsers' url/search bars already have this shortcut capability. Apr 4, 2012 at 14:28

5 Answers 5

5

Unless you're willing to get the IP address for every site you wish to shorten. It's not very feasible, but it works.

Edit your hosts file and input as follows:

74.125.47.103 goog

If you go into your web browser and type goog, goes directly to that IP.

It works if you wanna go straight to the IP, but if you're looking to input entire URLs, it's not a feasible solution and it's not going to work.

0
1

The hosts file only is suitable for mapping hostnames to IP adresses, thus it can't be used for this purpose.

A workaround can be creating bookmarks named after the "keywords" you want to use. E.g. a bookmark called 'goog' that redirects to http://www.google.com. With a service like Xmarks, it can be used across browsers.

1

If you are using the URL as a link, you can substitute a shorter URL with one of the common sites that take a long url and host a smaller, but cryptic url. Examples are Bitly and tinyUR. These are the type of truncations most blog posts use.

1

Also note another limitation of the host file approach: it breaks HTTP protocol version 1.1 (and above) virtual host functionality. Virtual host feature of HTTP protocol means you can have multiple host names handled by the same IP address. This works by the HTTP client (browser) inserting Host: header in the HTTP request. If you use shortened name, even if the request goes to the right IP address, the Host: field will have your shortened host name which will likely not be recognized by the HTTP server and you will not receive the expected page in this case.

Also I would expect breakage of secure HTTP (SSL) with this approach.

0

You can use http://www.opendns.com/ to create DNS aliases, which would do exactly what you want, see screenshot.

You must log in to answer this question.

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