5

I am running Ubuntu Desktop 12.04 and would like to be able to open a web browser (Firefox), type an alias into the address bar, hit enter, and have the browser take me to the site that the alias references. For instance, I'd like to be able to type in "so" and have it take me to http:www.stackoverflow.com, etc.

I realize this is what "Favorties" or "Bookmarks" already do, however, this is like the text-only, command-line version of those tools.

I suspect I have to configure something equivalent to a Windows HOST file, but since I'm so new to Linux/Ubuntu, I don't know what that equivalent is, or if this is even possible to do. Thanks in advance!

2 Answers 2

5

If you did this with the hosts file, you would have to use the IP address of the websites in question, which would probably be a bad idea. IP addresses change, aand most larger sites use several different IPs in a round-robin/load-balancing configuration. At any rate, to do that, just edit the /etc/hosts file, and add lines similar to this:

# alias for stackoverflow.com
64.34.119.12    so

That first line is just a comment, so you know what it's doing there later.

If you just want to have aliases for Firefox, there is an add-on called URL Alias. Just search for it in the add-ons for Firefox. The Alias Links extension in Chrome will do the same thing.

1

You can't do what you want using the /etc/hosts file, because it simply maps names to IP addresses. It does not perform HTTP redirects, which is what you are really after.

While it may work for some sites, many others (e.g. sites hosted on a shared IP) will not.

This page has some good reading material regarding the hosts file.

You must log in to answer this question.

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