More on search url (2)

This code is what i use in my site now. I think it already works.
Sorry I have to resend pull request, I don't know another way to do it. 
( maybe I am too lazy to learn about github ) :((