register_callback('smd_short_url', 'txp_die', 404); function smd_short_url($event, $step) { $urlparts = parse_url(hu); // Probably better regexes for this using [\d] etc $re = '#^'.$urlparts['path'].'([0-9].*)#'; $have_id = preg_match($re, $_SERVER['REQUEST_URI'], $m); if ($have_id) { $id = $m[1]; $permlink = permlinkurl_id($id); if ($permlink) { ob_end_clean(); header("HTTP/1.0 301 Moved Permanently"); header("Location: $permlink"); die(); } } } function smd_canonical($atts, $thing='') { global $pretext; extract(lAtts(array( 'type' => 'link', ), $atts)); assert_article(); $link = hu.$pretext['id']; $out = ''; if ($type=="link") { $out = ''; } else { $out = $link; } return $out; }