OK, here's what I did. Keep in mind it may not work for you, depending on your setup.
I was upgrading from phpbb 3.0.3 to vB CMS 4.0.
the old forum was on
www.mydomain.com/forum.
The new CMS was installed in the root.
Most of the code works just fine, but here's exactly what I changed from the default 404.php you can download off of this page (as of today anyway).
change
Code:
$old_folder = 'phpBB/';
to
Code:
$old_folder = 'forum/';
change
Code:
$standard_404 = 'http://www.example.com/not_found.html';
to
Code:
$standard_404 = 'http://www.mydomain.com/404.shtml';
this points to my existing 404 file
change
Code:
$new_domain = 'example';
to
Code:
$new_domain = 'www.mydomain.com';
change
Code:
$new_folder = 'vBulletin/';
to
notice I completely removed that string since I'm installing in the root.
changed the user, password and database variables to my particular values.
Inside
Code:
switch ($old_system)
{
case 'phpBB2' :
change
Code:
$old_thread_script = "viewtopic{$old_ext_type}?t=";
to
Code:
$old_thread_script = "viewtopic{$old_ext_type}?f=";
inside
Code:
// It's for the old forum
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}") === 0)
{
switch ($old_system)
{
case 'phpBB2' :
find
Code:
$old_id = intval(substr(substr($_SERVER['REQUEST_URI'], 2), 0, strpos(substr($_SERVER['REQUEST_URI'], 2), '&')));
now, I wasn't quite sure exactly what Jerry was doing with this code, so I just rewrote it so I'd know it would work. His might work just fine, but I didn't try it.
replace that line with:
Code:
$topic_loc = strpos($_SERVER['REQUEST_URI'],"&t=");
$end_loc = strpos($_SERVER['REQUEST_URI'],"&",$topic_loc+1);
if ($end_loc === FALSE)
{
$old_id = substr($_SERVER['REQUEST_URI'],$topic_loc+3);
}
else
{
$old_id = substr($_SERVER['REQUEST_URI'],$topic_loc+3, ($end_loc-($topic_loc+3)));
}
That's it.
I uploaded that to the root of my account, and made a .htaccess file with this line in it:
Code:
ErrorDocument 404 /404.php
I also deleted everything from the "forum" directory and uploaded an index.php file there that contains this:
Code:
<?PHP
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.mydomain.com/forum.php" );
?>
That way if someone tries to go to the old
http://www.mydomain.com/forum, they get redirected to the new forum page, and if someone tries to get a forum or topic, the 404.php gets it and redirects them correctly.