Returning Good URLs as Search Result Pages

Returning Good URLs as Search Result Pages

created 12/2/07

Requires Webglimpse 2.18.2 or above, and Apache 2.0.X or above. Not tested with Apache 1.X.

A URL such as is much more search engine and bookmark-friendly than one like

To return good urls from a search, you will need to be able to edit your Apache configuration file (not tested on non-Apache servers). Users may also require javascript enabled. Add a section similar to

        <Directory /path/to/www/search>
                RewriteEngine On
                RewriteCond     %{REQUEST_FILENAME} !-f
                RewriteCond     %{REQUEST_FILENAME}\/index\.html        !-f
                RewriteCond     %{REQUEST_FILENAME} !-d
                RewriteRule     .*      "/cgi-bin/wg2/webglimpse.cgi"
Restart Apache and check for any errors (view the log, and check that normal web pages work). Then, edit your search form and change the <FORM> tag to something similar to
	<FORM METHOD=POST ACTION="/search/" onSubmit="this.action = '/search/' + this.query.value">
This method requires the user to have Javascript enabled, as with apache 2.0.X it loses the form parameters. There is another method involving SetHandler and ErrorDocument, but it is beyond the scope of this document. So, using the method above, your last step is to edit webglimpse.cgi wherever it is installed and set
	$DEFAULT_ID = [n];                # where n is the archive ID you want to use; default is 1
Done! Now test your new search form.

If all you want are good URLs as search results, no need to continue. However, one more step will greatly increase the findability of your search result pages on Google:

Creating Static Search Result Pages

This ability exists in expectation of the next new feature - the ability of users to annotate search results. Right now the search results are not likely to expose new content (unless your site indexes many remote sites)

Enabling static search will cause Webglimpse to create a static HTML page in a specified directory for each search. To enable static search, edit the webglimpse.cgi script where it is installed and modify the following variables:

	# Set to 1 if you would like to generate static search pages/goodURLs

	# also set the following two
	$SEARCH_STATIC_DIR = '/path/to/docroot/search';    

Next, make sure the directory you set as $SEARCH_STATIC_DIR is writable by the web user (often apache or nobody).

Finally, you may want to place a link somewhere on your site to the search directory, so that the result pages can be found by Google and other search engines. This way the unique combinations of search results your site generates can be found directly by web searchers. The link would look something like

	<A HREF="">user searches</A>
That's it - any questions or problems, please contact us

Home ]  [ Downloads ]  [ Docs ]  [ ISC License ]  [ Webglimpse on Github ]  [ Support ]  [ Contact Us ]  [ Top of Page ]

see also our sites for:Tucson, Arizona ]  [ Dallas (Garland), Texas ]  [ : Ideas for Everyday Learning]  [ Where to Buy SlimeSuperFreakonomics: A Review re Game Theory and Economics based Policy

Webglimpse Advanced Site Search Software : providing flexible local search since 1997 ] 

Copyright © Internet WorkShop, 2002. All Rights Reserved.