At work, I’m the maintainer of some company internal standards. Some of them link to a section of of our public online documentation. The system that produces this doc doesn’t produce cool URLs. They are long, ugly, and change every time we do a major software release.

Q: How can I get out of the business of updating these URLs every six months? A: Hack Google’s “I’m Feeling Lucky” button.

Google crawls our site regularly and will always know where this page lives. If I tell Google what I want to link to, it will always know what the right URL is. By inspecting the HTML behind Google’s submit form, I came up with the following procedure.

First, figure out a search query that will always return the page you want as the first result. Here is what I typed into Google’s search box:

"Marking Up Text in Cells for Publishing" site:www.mathworks.com

I’m using two good search tricks here. First, I use quotes to surround the exact title of the section of the doc I want to reference. These individual words appear all over the doc, but this exact phrase is only on this page and pages that reference it. Secondly, I use the site: directive so the results will include only results for our website. I use this trick all the time (usually via the “Search only items on the current Web site” button on the Google Toolbar). Between the two of these, I can feel confident of finding the exact page I want.

I press “I’m Feeling Lucky” and confirm that Google indeed takes me to the desired page. Now I need to hack a URL that will do the same thing. I go back to the search page and press the usual “Google Search” button. Copy the URL in the search bar to use as your link, which looks something like this:

http://www.google.com/search ... &btnG=Google+Search

If you used this as-is, clicking on the link would bring you to the Google Search results. To make it skip the results and go straight to the first result, we just need to tweak it a little. Find “btnG” in the URL and change it to “btnI”. Now the link will take you straight to the desired page