[ic] Mod_rewrite & mod_interchange & short urls

Peter peter at pajamian.dhs.org
Fri Apr 20 05:55:01 EDT 2007


On 04/20/2007 02:38 AM, David Bordas wrote:
> I'm trying to modify urls like :
> http://www.testadaz.com/store/scan/co=yes/sf=prod_group/se=confitures/tf=category/va=categorie=confitures/va=ss_categorie=/st=db.html
> 
> to :
> http://www.testadaz.com/categorie/confitures.html

I use an actionmap for that.  Something like this should work for you:

ActionMap categorie <<EOA
sub {
        # Grab only the second val in path.
        my $cat = (split(m:/:, shift, 3))[1];
	# chop off the .html if applicable.
	$cat =~ s/.html$//i;

        my %scan = (
                st => 'db',
                co => 'yes',
                sf => 'prod_group',
                se => $cat,
                tf => 'category',
                va => "categorie=$cat\0ss_categorie=",
        );

        @{$CGI}{keys %scan} = values %scan;
        $CGI->{mv_todo} = 'search';
        $Tag->update('process');
        $CGI->{mv_nextpage} = $Config->{Special}->{results};
        return 1;
}
EOA


Peter


More information about the interchange-users mailing list