Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)

share|improve this question
2  
Is this so you don't have to type so much? Modern browsers' url/search bars already have this shortcut capability. –  Ben Richards Apr 4 '12 at 14:28

5 Answers 5

up vote 5 down vote accepted

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.

share|improve this answer
    
Thanks this works! –  fwaokda Apr 4 '12 at 14:39

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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