SMF and Multiple-Domain Support
Tuesday, August 11, 2009 20:42One thing I noticed when working on a forum earlier for a client was the fact that I couldn’t set it up to allow more than one domain. I searched online and found nothing. So I took the development root of tweaking the coding.
It wasn’t all that hard to do – it’s just a matter of redefining the variable $board_url outside of the “settings.php” file. Of course, making sure it’s defined after the “settings.php” file is loaded, otherwise it will be overwritten.
So load up your “index.php” file – and head down to line 50/51. Where you’ll see:
// Load the settings...
require_once(dirname(__FILE__) . '/Settings.php');
Now below that paste the following code:
//Redefine the board URL - Multiple Domains
$boardurl = 'http://' . $_SERVER['HTTP_HOST'] . '/forum';
Of course, make sure you modify the ‘forum ‘ to the sub-directory that you’re using. That variable mustn’t contain a trailing slash!
That’s it, save it, and you’re done.
Note: the redefining of the boardurl will not be mirrored into your server settings.