I am assuming they route the request through a page that checks the database for the seo-title.
RewriteRule ^questions/([0-9]+)/?$ routepage.php?id=$1 [R=301,L]
RewriteRule ^questions/([0-9]+)/(.*)/?$ routepage.php?id=$1&title=$2 [R=301,L]
And a file routepage.php
$page = getSeoTitleFromDatabase( $_GET['id'] );
if( $page != $_GET['page'] ) {
header( "HTTP/1.1 301 Moved Permanently" );
header( "Locations: /questions/" . $_GET['id'] . "/" . $page );
}
//Do whatever...
I am not aware of a way of checking the database with .htaccess
or mod_rewrite
.