Gossamer Forum
Quote Reply
Rewrite URLs
Hi!

Is there a possibility to do something similar with .htaccess file, as is the case with GForum, to get a "more normal" URLs in the following case:

<%config.db_cgi_url%>/search.cgi?query=abcdefg

in:

<%config.build_root_url%>/newfolder/abcdefg/ or <%config.build_root_url%>/newfolder/abcdefg.html (perhaps even better)

only in those cases where there is a search result (which means not to make a URL if there is no result for search term) while at the same time retain the current page structure including title, description, navigation, etc.?

Two more things:

1.) In case of "<%config.db_cgi_url%>/search.cgi?query=abc d efg" make "<%config.build_root_url%>/newfolder/abc-d-efg/" or "<%config.build_root_url%>/newfolder/abc-d-efg.html" to avoid empty fields (in fact the same applies to everything that is not a-z and 0-9 and if possible all lowercase).

2.) Could it be all together now displayed as a list, let us say "25 recent searches", "25 recent tags" or similar on a new page?

Thank you in advance.

Last edited by:

katakombe: May 14, 2010, 8:47 AM
Quote Reply
Re: [katakombe] Rewrite URLs In reply to
Hi,

Its possible to do (easier when just single words)

The problem with using - as a seperator, is that it means you need to edit search.cgi to convert theose "-" charachters into " " again.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Rewrite URLs In reply to
Hi Andy!

Andy wrote:

Its possible to do (easier when just single words)

This section is of course clear itself ...Smile

Andy wrote:

The problem with using - as a seperator, is that it means you need to edit search.cgi to convert theose "-" charachters into " " again.

I'm not sure I understand this completely ..

Thanks Andy
Quote Reply
Re: [katakombe] Rewrite URLs In reply to
Hi,

Well, the way to link to it, would be a simple global:

clean_string_for_search
Code:
sub {
my $string = $_[0];
$string =~ s/\s/-/sig;
return $string;
}

Then call with:

<%clean_string_for_search($query)%> (or whatever the value of the query is)

Then, in search.cgi - you would need to probably add $IN into VARS//, and then something like:
Code:
if ($IN->param('query') =~ /\-/) {
my $tmp = $IN->param('query')l
$tmp =~ s/\-//sig;
$IN->param('query' => $tmp);
}

..then a rewrite rule something like:

Code:
RewriteRule ^search/(.*)$ /cgi-bin/search.cgi?query=$1 [L]

Not tested at all (I'm about to go out, so kinda rushing ;))

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Rewrite URLs In reply to
Hi Andy!

I'll give a try, ...

Thanks ..