Found the answer online, we have to use: CANONICAL
However, q2a is not setting the canonical of duplicate questions to the original one.
From what I see the qa-page-question.php is setting the canonical link on line 341... with:
// set the canonical url based on possible pagination
$qa_content['canonical']=qa_path_html(qa_q_request($question['postid'], $question['title']),
($pagestart>0) ? array('start' => $pagestart) : null, qa_opt('site_url'));
So we need to check if the question is duplicate, this is how I did it (it works):
$qa_content['canonical']=qa_path_html(qa_q_request($question['postid'], $question['title']),
($pagestart>0) ? array('start' => $pagestart) : null, qa_opt('site_url'));
// added: if duplicate set canonical to original question
if(isset($question['closedbyid'])) {
$origQuTitleQuery = mysql_fetch_array( qa_db_query_sub('SELECT title FROM `^posts` WHERE `postid` = "'.$question['closedbyid'].'"') );
$origQuTitle = $origQuTitleQuery[0];
$qa_content['canonical'] = qa_path_html(qa_q_request($question['closedbyid'], $origQuTitle),
($pagestart>0) ? array('start' => $pagestart) : null, qa_opt('site_url'));
}
Current note: I have just seen that each closed question gets also the CLOSEDBYID ... so the open question is, what is the identifier for closed-as-duplicate-questions?
Update: Now I see that the closedbyid has to be checked, if it is 'type'==NOTE then it is a normal closed question, if it is of type==Q then it is a duplicate!
@gidgreen: Could this be fixed in the next version?
Thanks, Kai