• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Redirection Scripts for vBulletin 3.x

Status
Not open for further replies.
Thanks ... after I found the name of the import log table, it works great now! I had some difficulty finding out the name of the table however, is there an easy way to view (and repair) all the tables in xenForo? I didn't see anything in the Tools.
 
You can use the MySQL Databases option in cPanel to repair the DB, if necessary.

To view the tables you can use phpMyAdmin.
 
All my redirects are going to forum home, so I assume I have a problem with my import log table. My table is archived, anyone see anything wrong with this from my 301config? My log looks to be inside my xenforo database.

define('IMPORT_LOG_TABLE', 'archived_import_log');
 
Still haven't gotten this figured out, anyone have an idea?
It's not something that could easily be worked out on a forum such as this. If you are trying to have un-modified vb3.8 urls redirected to the proper threads after an xf conversion, I *might* be able to help - but I would need access to the account. PM me if you want me to try.
 
All my redirects are going to forum home, so I assume I have a problem with my import log table. My table is archived, anyone see anything wrong with this from my 301config? My log looks to be inside my xenforo database.

define('IMPORT_LOG_TABLE', 'archived_import_log');

I had exactly the same problem.
Dean, thank you. It appears I figured this one out at the last minute.
In http://xenforo.com/community/threads/redirection-scripts-for-vbulletin-3-x.5030/ you find the newest release, version 6. There is a script 301config.php included. This script includes text about how to use this script. However this text is not commented. That's why this script does not work. Fix is to outcomment the text or just delete it.
 
This is the content of 301config.php

What exactly is the problem you are seeing? Because it looks to me exactly as it should be.
PHP:
<?php

/* ----------------------------------------------------------- *\
This variable defines where XenForo is installed.

If you have not installed XenForo into the same directory in which
vBulletin was installed, you will need to provide the full path to
the XenForo directory here. Remove the leading // and then enter
the path as in the following examples:

	$fileDir = '/home/example/public_html/new_forums';

	$fileDir = 'C:/inetpub/wwwroot/xenforo';

\* ----------------------------------------------------------- */

//	$fileDir = '/home/username/www/forums';

/* ----------------------------------------------------------- *\
This constant defines the table from which the import redirection
scripts will fetch their data. Normally they will use the table
'xf_import_log', but if you have archived your import data, you
should provide the name of the archive table here. Remove the
leading // and then replace 'import_log_x' with the name of your
archive table, as in the following examples:

	define('IMPORT_LOG_TABLE', 'my_import_log');

	define('IMPORT_LOG_TABLE', 'import_log_my_forums');

\* ----------------------------------------------------------- */

//	define('IMPORT_LOG_TABLE', 'import_log_x');
 
Hi Kier! I have manipulated the $filedir and define lines within the /* */ comments. I bet the other user who had a similar experience did the same. For a non-coder it is not so easy to figure out which lines you can uncomment and which you can. First I was thinking why aou would define two times different import log tables. This could make it more obvious that the variables are within the comments:

PHP:
<?php

/* ----------------------------------------------------------- *\
This variable defines where XenForo is installed.
If you have not installed XenForo into the same directory in which
vBulletin was installed, you will need to provide the full path to
the XenForo directory here. Remove the leading // and then enter
the path as in the following examples:
    $fileDir = '/home/example/public_html/new_forums';
    $fileDir = 'C:/inetpub/wwwroot/xenforo';
\* ----------------------------------------------------------- */

//    $fileDir = '/home/username/www/forums';

/* ----------------------------------------------------------- *\
This constant defines the table from which the import redirection
scripts will fetch their data. Normally they will use the table
'xf_import_log', but if you have archived your import data, you
should provide the name of the archive table here. Remove the
leading // and then replace 'import_log_x' with the name of your
archive table, as in the following examples:
    define('IMPORT_LOG_TABLE', 'my_import_log');
    define('IMPORT_LOG_TABLE', 'import_log_my_forums');
\* ----------------------------------------------------------- */

//    define('IMPORT_LOG_TABLE', 'import_log_x');
 
The instructions say that one should remove the leading slashes. As there are only two instances of leading slashes, I thought it was rather clear?
 
Don't underestimate the user with how he can figure everything out :D Your notice is clear and very understandable.

I first thought that there was a problem in the script as there were already lines in place without leading slashes. Coming from a vb environment where I had to constantly looking through the code so that it does not do something completely different than it said (example: put a banner on the forum when it is marketed as a acp plugin), I thought there was a mistake.

Still, I feel my example file is a bit more obvious which lines the admin can edit :)
 
I want to suggest a config option for the redirect scripts to allow page numbers to pass through. For example:

showthread.php?t=9710&page=2

This would allow admins to preserve old page number links if they know that both forums have the same number of posts per page.
 
Another suggestion:

In the redirection script showthread.php first check the post id and then the thread id to fetch the more specific page / message when a url includes both page and thread information. In general, always check the most specific urls and then go more general.

Now showthread.php?t=234&p=234 would redirect always to the first page. But if the post would be on the third page, my suggestion would redirect not only to the right third page, but also anchors directly to the post which is excellent.
 
Another suggestion:

In the redirection script showthread.php first check the post id and then the thread id to fetch the more specific page / message when a url includes both page and thread information. In general, always check the most specific urls and then go more general.

Now showthread.php?t=234&p=234 would redirect always to the first page. But if the post would be on the third page, my suggestion would redirect not only to the right third page, but also anchors directly to the post which is excellent.
Change showthread.php to this
Code:
$target = false;
if ($input['p'])
{
$newId = $importModel->mapPostId($input['p']);
if ($newId)
{
$target = XenForo_Link::buildPublicLink('canonical:posts', array('post_id' => $newId));
}
}
else if ($input['t'])
{
if ($newId = $importModel->mapThreadId($input['t']))
{
$target = XenForo_Link::buildPublicLink('canonical:threads', array('thread_id' => $newId));
}
}
 
And this is a very quick fix for "page=1234" import. You have to have on both forums the same "posts / page" ratio. In showthread.php change to
$input = $inputHandler->filter(array(
't' => XenForo_Input::UINT,
'p' => XenForo_Input::UINT,
'page' => XenForo_Input::UINT
));

$importModel = XenForo_Model::create('XenForo_Model_Import');

$target = false;
if ($input['p'])
{
$newId = $importModel->mapPostId($input['p']);
if ($newId)
{
$target = XenForo_Link::buildPublicLink('canonical:posts', array('post_id' => $newId));
}
} else if ($input['t'])
{
if ($newId = $importModel->mapThreadId($input['t']))
{
if($input['page']) { $tmp_addtourl = "page-" . $input['page']; }
$target = XenForo_Link::buildPublicLink('canonical:threads', array('thread_id' => $newId)) . $tmp_addtourl;
}
}
 
Marcus,

I've never seen this showthread.php?t=234&p=234 construction you reference, where both thread ID and post ID are specified. I'm pretty sure it's not in vBulletin 3. Is it in vBulletin 4?
 
The showthread.php?t=234&p=234 structure is indeed how vB4 works... it's a dumb way to get to the page a post is on, without specifying the page=xx...

Sadly, it creates duplicate content with unique URLs for every individual post on a thread (a thread displaying 20 posts can have 21 different URLs for the same content). I've always hated that, and for digitalpoint.com, I actually intercept any showthread.php call that has p=xxx in it and redirect it to a proper URL... showthread.php?t=1234&page=3#post343454 for example.
 
Status
Not open for further replies.
Top Bottom