[wp-hackers] Rewriting search URL

David House dmhouse at gmail.com
Thu Apr 21 20:42:36 GMT 2005

On 4/21/05, Peak Discharge <chmoka at gmail.com> wrote:
> Any ideas people? 

The way I do it on my weblog [1] is to set the search form (i.e., the
form in wp-includes/sidebar.php) method to POST to
/archives/search-results, then redirect this with .htaccess to
/index.php. However I've written my own search code [2] so things are
actually a little more complex than that... however I think what I've
just mentioned should work straight off, as the query-string stuff in
wp-blog-header.php looks at both $_POST and $_GET.

This isn't a perfect solution either, as it means you can't bookmark
(or link to, etc.) searches as they don't have a specific URL. However
I'm not sold on the idea that bookmarking searches will ever be
possible unless you pass the search parameters through GET which makes
for polluted URLs, which I really don't like.

Anyway, some thoughts there.

[1]: http://xmouse.ithium.net
[2]: http://xmouse.ithium.net/essays/improving-the-wp-search/

-David House, dmhouse at gmail.com

More information about the wp-hackers mailing list