Resolve 404 on posts without category

Ok, resolved it in 404.php

<?php 

$klo_link = $_SERVER['REQUEST_URI'];  
if (preg_match("/^\/[a-zA-Z0-9\-\_]+\/$/", $klo_link)) {    
//echo "A match was found.    \n";  
//echo $klo_link;   
header("HTTP/1.1 301 Moved Permanently");   
header("Location: ".get_bloginfo('url')."/a".$klo_link);    
exit();
 }else {    
get_header();
}

Put that at the beginning of the 404.ph