I have just added a nice rewrite rule that allows my to detailed pages with the following url
http://www.domain.com/dir1/dir2/dir3/Title_of_the_Link_L123/
instead of
http://www.domain.com/Detailed/123.html
which is (I think) better for google and the like. This only works in static mode, btw.
In order to do this, you need a global, called rewrite_url, which is
my $ID = shift;
my $Title = shift;
my $cats = $DB->table('Links')->get_categories($ID);
my ($cat_id,$cat_full_name) = each %$cats;
my $cat_url = $DB->table('Category')->as_url($cat_full_name);
$Title =~ y/ \t\r\n?"'#/__/d;
return '/' . $cat_url . '/' . $Title . '_L' . $ID . '/';
}which you can use in your link.html template as
<a href="<%rewrite_url($ID,$Title)%>"><%Title%></a>
The rewrite rule you need to add is something like
RewriteRule ^.*L([0-9]+)/?$ /Detailed/$1.html [L]
Ivan
-----
Iyengar Yoga Resources / GT Plugins
http://www.domain.com/dir1/dir2/dir3/Title_of_the_Link_L123/
instead of
http://www.domain.com/Detailed/123.html
which is (I think) better for google and the like. This only works in static mode, btw.
In order to do this, you need a global, called rewrite_url, which is
Code:
sub { my $ID = shift;
my $Title = shift;
my $cats = $DB->table('Links')->get_categories($ID);
my ($cat_id,$cat_full_name) = each %$cats;
my $cat_url = $DB->table('Category')->as_url($cat_full_name);
$Title =~ y/ \t\r\n?"'#/__/d;
return '/' . $cat_url . '/' . $Title . '_L' . $ID . '/';
}
<a href="<%rewrite_url($ID,$Title)%>"><%Title%></a>
The rewrite rule you need to add is something like
RewriteRule ^.*L([0-9]+)/?$ /Detailed/$1.html [L]
Ivan
-----
Iyengar Yoga Resources / GT Plugins