[wp-hackers] Rewriting search URL

Mark Jaquith mark.wordpress at txfx.net
Fri Apr 22 00:46:07 GMT 2005


Peak Discharge wrote:

> That changes my url into the form of 
> http://www.unicorns.com/?s=string, which is a progress. The aim, 
> however is to change all search urls to 
> http://www.unicorns.com/search/string


How about this?  Seems to work for me.

<?php

if ($_REQUEST['s'] && strpos($_SERVER['REQUEST_URI'], '/search/') === 
FALSE ) {
$redirect_to = get_bloginfo('home') . '/search/' . $_REQUEST['s'];
wp_redirect($redirect_to);
exit();
}

?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/wp-hackers/attachments/20050422/4505ec73/attachment.html


More information about the wp-hackers mailing list