Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Search Friendly without Rewrite

Quote Reply
Search Friendly without Rewrite
Hi,

I put together the search engine friendly templates for our mailing archive demo, but decided to try it without rewrite. I basically just added:

Code:
my $path = $ENV{PATH_INFO};
if ($path) {
my $t = $IN->param('t') || 'search_engine';
$IN->param('t', [$t]);
if ($path =~ m,P(\d+)/?$,) {
$IN->param('post', [$1]);
}
elsif ($path =~ m,P(\d+)-(\d+)/?$,) {
$IN->param('post', [$1]);
$IN->param('page', [$2]);
}
elsif ($path =~ m,C(\d+)/?$,) {
$IN->param('category', [$1]);
}
elsif ($path =~ m,F(\d+)/?$,) {
$IN->param('forum', [$1]);
}
elsif ($path =~ m,F(\d+)-(\d+)/?$,) {
$IN->param('forum', [$1]);
$IN->param('page', [$2]);
}
else {
$ENV{PATH_INFO} = '';
}
}

to the beginning of gforum.cgi (right after init()). Then I added the search engine templates described in the other forum, and instead of going to /forum/, I changed it to go to /perl/mailarc/archive/ where archive is a symlink to gforum.cgi (I could have kept the URL's looking like /perl/mailarc/gforum.cgi/ but thought it would look better without the .cgi).

If you want to try this yourself, the steps are:

1. Symlink or copy gforum.cgi to a file called archive and make sure you can run it just like gforum.cgi (should be able to display the home page).
2. Edit archive and add the code above just after init().
3. Add the search_engine templates from the earlier thread.
4. Replace /forum in those templates with /cgi-bin/gforum/archive.

And that's it! Unfortunately because IIS does not have a working PATH_INFO, I'm afraid this won't work on IIS servers. =( You can see the final result at:

http://gossamer-threads.com/perl/mailarc/archive/

Cheers,

Alex
--
Gossamer Threads Inc.
Subject Author Views Date
Thread Search Friendly without Rewrite Alex 5279 Feb 12, 2002, 1:41 AM
Thread Re: [Alex] Search Friendly without Rewrite
ellipsiiis 5002 Feb 19, 2002, 11:01 AM
Thread Re: [ellipsiiis] Search Friendly without Rewrite
Alex 4975 Feb 19, 2002, 11:42 AM
Post Re: [Alex] Search Friendly without Rewrite
ellipsiiis 4971 Feb 19, 2002, 12:41 PM