I have choose to add into Plugins Manager and works correctly with BBURL vBulletin variable:
init_startup
PHP Code:
$web_home = $vbulletin->options['bburl'];
if ( $_SERVER['REQUEST_URI'] == str_replace('http://' . $_SERVER['HTTP_HOST'], '', $web_home) . '/index.php' )
{
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $web_home . '/');
exit();
}
if ( strpos($_SERVER['HTTP_HOST'], 'www.') === 0 && strpos($web_home, 'http://www.') === false )
{
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://' . substr($_SERVER['HTTP_HOST'], 4) . $_SERVER['REQUEST_URI']);
exit();
}
else if ( strpos($_SERVER['HTTP_HOST'], 'www.') !== 0 && strpos($web_home, 'http://www.') === 0 )
{
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit();
}
No need any modifications or settings.
Regards.