How do you get cruft free URIs for search results?

To return clean URIs for search results in WordPress from the search form (www.example.com/search/searchterms instead of www.example.com/?s=searchterms)

First create a file called search.php which contains:

<?php header('Location: http://www.example.com/search/' . $_GET['s']); ?>

Put that file in the root of your WordPress install and alter the action for the search form to this:

action="<?php bloginfo('url'); ?>/search.php"

See also: