Help with PicoSearch

How can I redirect my URLs in the search results?

Normally when PicoSearch displays your search results, each page has a link directly back to itself on your site. But what if you want to send the user to a slightly different URL? PicoSearch provides several ways to redirect or change the URLs in the search results, and these can be useful in different situations.
  1. Redirecting by patterns at indexing time: Whole sets of URLs can be adjusted at the time of indexing, by patterns entered in your account manager. This is good for example to build your search engine based on a mirror site and then show the main site in the search results. See the Automatic Redirections feature in the URL Adjustments section of your account manager.

  2. Redirecting specific pages by tags on the page: A special PicoSearch redirection tag called PICOREDIRECT, detailed below, can be placed on any HTML page so that the URL that will be seen in the search results is different from the original link. This can be useful for frames, where one panel of a frameset should really never be seen by itself but always go to the outer frameset. For more information on how to use PicoSearch in frames, see What can I do about Framesets and Frames? Advanced site designers may also experiment with javascript to automatically pop lone frames into their parent framesets, similar to the frame resetting technique shown in the FAQ for How can I stop another site from hijacking my search engine within their frames?

  3. Redirecting dynamically, at search runtime, by adjusting the result URLs: PicoSearch provides hidden arguments for the search box call to adjust the URLs on the search results page. One use of this is to insert information which preserves a visitor's shopping cart on an ecommerce system which is dependent on URL states. A specific example of using the prepath, postpath, and nopath arguments can be seen in the FAQ on shopping carts. For more general descriptions see below. Another argument called redirurl is even more generalized, as a runtime version of the account manager's Automatic Redirections feature. See below for details. For example, this could be used to redirect search results to different subdomains depending on the subdomain being searched, after the search engine has indexed one representative website.

PICOREDIRECT: PicoSearch provides a special tag that is easy enough for everyone to use in any file that needs to go to another file when searched. The PICOREDIRECT tag will substitute another URL for a page's search result, when this tag is inserted into the body of the first page. It looks like this:
 
<!-- PICOREDIRECT=
"http://www.mysite.com/frameset.html" -->

 
Now when your visitors click on this page in the search results, PicoSearch will send them to the parent frameset (or another page if you have something crafty in mind). Just make sure that the URL to the redirection is the fully-qualified URL to your website domain.
 
Since redirection is generally used to get out of frames, a default target=_top will be given to pages that use PICOREDIRECT. This default is overridden by the global setting for "Bring up clicked URLs..." in the Configure Results section of your account manager. And to override all defaults you can easily add your own target in the PICOREDIRECT line as seen below. Be sure to include the quotes, they are needed:
 
<!-- PICOREDIRECT=
"http://www.mysite.com/anotherpage.html" target="anotherpanel" -->

 

PREPATH: a hidden argument at runtime from the scope of the HTML search call FORM, to insert a string after the domain in the search result links. For example:
<input type="hidden" name="prepath" value="cgi-bin/linker.exe?filename=" />
would turn the search result URL:
http://www.mysite.com/about.htm
into:
http://www.mysite.com/cgi-bin/linker.exe?filename=about.htm


POSTPATH: a hidden argument at runtime from the scope of the HTML search call FORM, to insert a string after each file name in the search result links. Postpath is smart enough that if it starts with ? to add arguments to a url, and the url already has some args, then postpath uses & to append more args. For example:
<input type="hidden" name="postpath" value="?caller=34752" />
would turn the search result URL:
http://www.mysite.com/products.asp
into:
http://www.mysite.com/products.asp?caller=34752


NOPATH: a hidden argument at runtime from the scope of the HTML search call FORM, to prevent a space-separated list of URL patterns, which can include wildcards, from begin altered by prepath and postpath. For example:
<input type="hidden" name="nopath" value="*.htm http://www.mysite.com/pdfs/*" />
would prevent postpath and prepath from altering the following URLs:
http://www.mysite.com/about.htm
http://www.mysite.com/pdfs/about.pdf



REDIRURL: a hidden argument at runtime from the scope of the HTML search call FORM, analagous to the Automatic Redirections feature in the URL Adjustments section of the account manager. A URL pattern which can include wildcards is followed by == with a replacement for that pattern in every search result link which matches. Multiple change pairs can be separated by commas. For example:
<input type="hidden" name="redirurl" value="http://www.==http://www2." />
would turn the search result URL:
http://www.mysite.com/products.asp
into:
http://www2.mysite.com/products.asp







Back to FAQs