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.
Quote Reply
Re: [Alex] Search Friendly without Rewrite In reply to
I set the path_info permissions in the IIS metabase so that's working, but I think I'm missing a step or something:

http://www.surviiivor.com/...s/archive/forums.cgi

They just go to dead links.


Realiiity.com Forums
Quote Reply
Re: [ellipsiiis] Search Friendly without Rewrite In reply to
Unfortunately I don't think IIS can handle PATH_INFO. In order for this to work, you need:

http://www.surviiivor.com/...1/Survivor_News_F21/

to run forums.cgi and set in the PATH_INFO environment variable '/Spoling_C1/Survivor_News_F21/'. However when you try to go to that URL, you get a 404 file not found meaning IIS is actually trying to find that directory. Apache will realize that forums.cgi is a program, and run the program.

On the Mail Archive demo, I was also able to rename gforum.cgi to just `archive` with no extension. I don't think you can do this with IIS either as is runs the program based on the file extension.

What does the 'path_info permissions in the IIS metabase' control? I'm not familiar with that.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Search Friendly without Rewrite In reply to
IIS doesn't allow the path_info environment variable by default, but it's possible to change the setting in the metabase, which is the area where IIS stores all its settings.

I misunderstood your instructions. Archive is an actual directory. I'll mess with it and see if I can get it to work somehow.


Realiiity.com Forums