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

The nuclear arms race is like two sworn enemies standing waist deep in gasoline, one with three matches, the other with five.

—Carl Sagan