journal features
movie reviews
photo of the day

turning your (webserver's) frowns into smiles

the journal of Michael Werneburg

twenty-seven years and one million words

Tokyo, 2010.07.31

Here's a trick I found suggested in a comment on a site explaining the configuration of some web server software.

If you get a request for something that's not a valid resource on your website, simply turn that request into a search for that content on your site. It all hinges on configuring your server to redirect the requests to a certain search engine URL.

I like DuckDuckGo these days (a lot) so I've turned any "not found" request into a DuckDuckGo search. For instance, try http://emuu.net/beamsville or http://emuu.net/banana or http://emuu.net/calamity.

You'll note that I used the target URL http://duckduckgo.com/?q=site%3Aemuu.net+ and simply append the searched-for term.

I've done the same on the company's website (using Google Japan for search results instead) in my nginx.conf as follows:

if (!-f $request_filename) {

rewrite /(.*) http://www.google.co.jp/search?hl=ja&q=site%3Acaritas.co.jp+$1

break;

}

rand()m quote

I am, somehow, less interested in the weight and convolutions of Einstein's brain than in the near certainty that people of equal talent have lived and died in cotton fields and sweatshops.

—Steven J. Gould