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 http://yoursite.com/search/keyword is much more search engine and bookmark-friendly than one like http://yoursite.com/cgi-bin/webglimpse.cgi?query=keyword&other_options.

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"
        </Directory>
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
	$MAKE_STATIC_SEARCH_PAGES = 1;

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

	$SEARCH_STATIC_BASEURL = 'http://somedomain.com/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="http://somedomain.com/search/">user searches</A>
That's it - any questions or problems, please contact us

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

see also our sites for:Tucson, Arizona ]  [ Dallas (Garland), Texas ]  [ bTeaching.com : Ideas for Everyday Learning

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


Copyright © Internet WorkShop, 2002. All Rights Reserved.