Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
387 views
in Q2A Core by
Hello

I want to run multiple Q2A websites on different domains with the same database ; I know that it is possible and to do that I have to make changes to QA_MYSQL_TABLE_PREFIX setting in qa-config.php file .

Help !
Q2A version: 1.5

1 Answer

+1 vote
by
edited by

This is more of a PHP issue. Check the variable $_SERVER, to see which domain the user comes from, and set the QA_MYSQL_TABLE_PREFIX accordingly. Other configuration can be set this way too. Somthing like this maybe:

$table_prefix = '';
switch ($_SERVER['HTTP_HOST']) {
    case 'example.com':
        $table_prefix = 'qa_org_';
        break;
    case 'example.com':
        $table_prefix = 'qa_com';
        break;
    default:
        // Handle error
}
define('QA_MYSQL_TABLE_PREFIX', $table_prefix);
You could even choose different databases like this
 
Hope it helps...
...