<img style=”float:left;width:120px;padding-right:4px;padding-top:5px;” src=’http://www.sciencetext.com/wp-content/uploads/2008/01/alex-king-blog.jpg’ alt=’Alex King Blog’ />Fellow blogger Alex King is an exceptionally talented guy, he never ceases to amaze me with his adeptness in creating new, and more important useful plugins for the likes of WordPress and for making the most of some of the simplest little hacks.
He recently posted a hack for your .htaccess file (you have to have Apache hosting for your site or blog for this to work). The hack makes searching your site very straightforward via a URL rather, but also simplifies the results address produced by your inline search box.
First, make a backup of .htaccess, then add the following
RewriteRule ^search/(.+)?$ /index.php?s=$1 [QSA,L]
to your .htaccess file and save the new .htaccess file.
To do a site search simply use a URL of the form www.yourdomain.com/search/your+search+terms
e.g. to search this site for “google tips” you would use the URL www.sciencetext.com/search/google+tips
As you can see, the search pulls up all the relevant results, but the URL for search results page is as it is, without the hack, the address is “http://www.sciencetext.com/?s=google+tips”. I think it’s much neater with that quasi search folder.
Alex goes on to add that you can modify the search form on your site so that the same kind of URL shows up when your visitors search: In your theme, simply add an “onsubmit handler” to the form tag for the search form, visit his site to get the skinny on that hack.