[wp-hackers] OpenSearch RSS Autodiscovery for Searches - Kinda

Chris Pirillo chris at lockergnome.com
Mon May 22 03:51:56 GMT 2006


Hackers,

I just got OpenSearch configured. Kinda. It's not really working the way it
should yet.

This works:
 http://chris.pirillo.com/wp-content/plugins/opensearch/description.php

This works:
 http://chris.pirillo.com/wp-content/plugins/opensearch/opensearch.php?s=boo

This doesn't, and it should (according to .htaccess, TMK):
 http://chris.pirillo.com/os-query?s=book

One new line in the .htaccess (single line):
RewriteRule ^os-query?(.*)$
/opt/sp/pirillo.com/chris.pirillo.com/wp-content/plugins/opensearch/opensear
ch.php?$1 [QSA,L]

I'm not sure what I messed up, as the file is definitely in that location on
my server (per the working hyperlink above). The shorter URL should work,
and when combined with a real search, you'll see AutoDiscovery enabled:
 http://chris.pirillo.com/index.php?s=bingo

And for that, you'll need this code in your header.php template:

<?php if (is_search()) { ?>
<link rel="alternate" type="application/rss+xml" title="<?php
bloginfo('name'); ?>: <?php echo wp_specialchars($s); ?>"
href="http://chris.pirillo.com/os-query?s=<?php echo wp_specialchars($s);
?>" />
<?php } ?>

Thanks to these two folks for getting the ball rolling:

 http://www.williamsburger.com/wb/archives/opensearch-v-1-0/

 http://www.robinsonhouse.com/2005/12/31/wp-opensearch-10-fix-for-wp-20/

Chris



More information about the wp-hackers mailing list