View Full Version : Miscellaneous Hacks - 404 / 301 after import redirect on import ids
Jerry
04-22-2008, 10:00 PM
After importing from a source board there will be internal and external links that point to the old URLS.
During the import the origional import id's are kept (for one import) so a redirect can be calculated to find the new user/forum/thread/post, by looking up the old import{$type}id.
ImpEx currently alters the table to add the import id, though a planned future version will have this separated so multi-import sites can be managed,
The original discussion thread on vBulletin.com :
http://www.vbulletin.com/forum/showthread.php?t=178161
It is advised that $do_404 = false; is set so the 301 is sent with the new URL to update search engines.
The script needs setting up and customising to each site as the domains and URLs can be different.
paramegsoft
04-23-2008, 07:20 PM
welcome Jerry
does this script work ok to phpbb3
Jerry
04-23-2008, 07:38 PM
This will work with forums where you can parse the URL to get the old id and the script will look up the new one.
As with any install of it, you have to customise it for your site.
jca2112
04-24-2008, 12:03 AM
I assume the "ipd2" setting (for Invision 2.0) would also work for Invision 1.3 imports? (I believe the IPB url structure is the same for 1.3 and 2.0+ versions, no?)
Jerry
04-24-2008, 12:13 AM
If the URLs, GET vars and file names are the same, I would of thought so yes.
Lateuk
05-01-2008, 03:09 PM
Just tried it on a test install (in the process of going from PHPBB2 to vBulletin) and it works a treat.
Thanks
Jerry
05-01-2008, 05:54 PM
Good to know :)
jbeam
07-15-2008, 12:31 PM
I have an odd problem. It works for everything but User Profiles. When someone clicks on an old user profile link from PHPBB2 it takes the user to Profile 0 in vBulletin. If you set it to debug mode, sure enough, no matter what old user profile link you click on it comes back as 0.
Now, I am not totally code illiterate, but I come from the C++ / VB world and know very little about PHP. I have tried to follow the code, but I just can not grasp what some of the functions are doing.
If anyone has had this problem and found a solution, please let me know.
Jerry
07-15-2008, 03:10 PM
Sounds like you have a different user URL to the one that is being expected.
Can you give an example of the old phpBB profile URL that is being requested ?
jbeam
07-21-2008, 02:54 PM
http://thenewx.org/phpbb2/profile.php?mode=viewprofile&u=1594
This is an example of one of the old URL's. From what I can tell it looks right.
jbeam
07-28-2008, 01:18 PM
Anyone have any ideas?
tommythejoat
07-29-2008, 02:07 PM
Jerry,
I am planning to install this for my bbV2 migration. I presume there is no reason to keep all the code for the other message board combinations with the conditionals, switches and so forth. I can just hard code it for the bbV2 url forms.
bbV2 does not support displaying posts independently of threads, and does not support displaying user profiles externally. I was planning to just provide the translation of thread and forum references.
Since bbV2 is a Perl script, the form of the urls are /bbBoard.cgi?a=viewthread;fid=3;gtid=305734 for a thread and bbBoard.cgi?a=viewforum;fid=3 for a forum. I could use your logic for the forum, but I will need to use a regular expression to skip the fid piece for threads.
When Jelsoft installed of vBulletin, they installed it in the root of the web (/var/www/html/) so there is no folder for the message board. I will need to modify the code to recognize this also.
When I have it working, I will post it here.
If you have any advice to offer, it would be appreciated.
Deepdog009
07-29-2008, 06:11 PM
Nice!!!
tommythejoat
07-30-2008, 01:02 PM
As mentioned in my previous response, I was modifying this tool to work with a bbBoardV2 migration.
A question comes up with respect to migrating between two different servers. The old server is still alive and clearly this script needs to run on the new server where vBulletin is located. If I put a redirect on the old board in place of the bbBoard.cgi script, I think that will handle it, but I am not sure.
Can anyone who has done this answer the question? My old board is currently live and I don't want to disrupt it just for an experiment.
I am attaching my modified version of 404.php (404t.php).
The contents of my .htaccess file are
ErrorDocument 404 /var/www/html/404t.php
php_flag log_errors on
php_value error_log /var/www/html/php_error.log
I have not yet run this and would appreciate a quick review. I found it was easier to extract values from the cgi style uri than I thought. The php intval function gets a number and ignores any following text. Therefore, you just need to start the evaluation following the "=" in the parameter string for the particular parameter. i.e. ;fid=, ;gtid=, ;pagenumber=.
Jerry
07-30-2008, 10:14 PM
http://thenewx.org/phpbb2/profile.php?mode=viewprofile&u=1594
This is an example of one of the old URL's. From what I can tell it looks right.
That is a default link for the profile and what the script is expecting, the default in the script should be fine, just set the domain :
$old_folder = 'phpBB/'; // With trailing slash
$old_ext_type = '.php'; // Including preceding dot
Jerry,
I am planning to install this for my bbV2 migration. I presume there is no reason to keep all the code for the other message board combinations with the conditionals, switches and so forth. I can just hard code it for the bbV2 url forms.
Yes, you don't need any of it, it's the import id's in the vBulletin tables and this script that take care of the look ups and refrences to old data.
bbV2 does not support displaying posts independently of threads, and does not support displaying user profiles externally. I was planning to just provide the translation of thread and forum references.
Half the work then :)
Since bbV2 is a Perl script, the form of the urls are /bbBoard.cgi?a=viewthread;fid=3;gtid=305734 for a thread and bbBoard.cgi?a=viewforum;fid=3 for a forum. I could use your logic for the forum, but I will need to use a regular expression to skip the fid piece for threads.
True, for the forum it looks like a fixed length string with the forumid on the end so crop the string and what ever is left is the forum id, as for the thread id, i'd use this :
// It's a thread link
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_thread_script}") === 0)
{
$action = 'thread';
$old_id = intval(substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], 'gtid=')+5));
$sql = "SELECT threadid FROM {$tableprefix}thread WHERE importthreadid={$old_id}";
}
Where :
$old_folder = "";
$old_thread_script = "bbBoard.cgi?a=viewthread";
For :
$_SERVER['REQUEST_URI'] = "/bbBoard.cgi?a=viewthread;fid=3;gtid=305734";
As mentioned in my previous response, I was modifying this tool to work with a bbBoardV2 migration.
A question comes up with respect to migrating between two different servers. The old server is still alive and clearly this script needs to run on the new server where vBulletin is located. If I put a redirect on the old board in place of the bbBoard.cgi script, I think that will handle it, but I am not sure.
You could update the DNS to send the old requests to the new server and have the web server handle it.
Jerry
07-30-2008, 10:19 PM
Nice!!!
With ice and a slice :cool:
tommythejoat
07-30-2008, 10:48 PM
Thanks Jerry,
I think I have it now.
I may not have easy control of the DNS. I will need to check it for a short time and switch it back. If this were one of my personal sites that is for sure what I would do.
:D Now if I could just get a response to my cleaner questions on the vbulletin.com community forum I would be good to go.
jbeam
07-31-2008, 12:05 PM
Jerry,
Thanks for your response.
I think everything is correct and like I said, everything except the profile links work with no problem.
Here is the top half of my 404.php.
#Currently supported : 'phpBB2' 'ubb.threads' 'vb3' 'ipb2'
$old_system = 'phpBB2';
// Domain
// Example :: http://www.example.com/phpBB/
$old_folder = 'phpbb2/'; // With trailing slash
$old_ext_type = '.php'; // Including preceding dot
$standard_404 = 'http://www.thenewx.org/404.htm'; // The usual 404 that this script replaces
// Example :: www.example.com/vBulletin/
$new_domain = 'www.thenewx.org';
$new_folder = 'forum/'; // With trailing slash
$ext_type = '.php'; // File extension type that vBulletin is using, i.e. index.php including the preceding dot
Jerry
08-01-2008, 05:22 PM
Have you set up the logging table in MySQL ? Does it have any entries for the profiles ?
jbeam
08-04-2008, 12:36 PM
I do have a logging table. It however does not have any entries for user profiles. There are a lot of ViewTopic requests and some 404 redirects (since the old phpbb directory does not exist).
Jerry
08-04-2008, 06:36 PM
I do have a logging table. It however does not have any entries for user profiles. There are a lot of ViewTopic requests and some 404 redirects (since the old phpbb directory does not exist).
The only thing I can think is finding the web server logs to see the exact request coming in and seeing what it is trying to parse.
diosrl
08-08-2008, 07:39 PM
I have a very simple problem with this mod. Why the script needs to be run for every single link?
We have three cases:
1. accessing a bookmarked or spidered link like www.example.com/oldforum/index.php. That /oldforum/ directory no longer exists, ofcourse.
2. click on an older link when browsing the new, vbulletin forum;
3. An ordinary link like example.com/test.htm, or example.com/contact.htm.
In all cases this mod is run, and i think it's not ok. First a root .htaccess must be setup, doing a redirect of all requests from /oldforum/ to /newforum/.
THEN, in the /newforum/ you can put a second .htaccess that redirects to 404.php and starts running the script.
In that way you don't parse every single link, but just the ones you are interested in. Am I correct?
For now, the only way to do this 404.php working, is to put the .htaccess in the root folder, and parse the 404.php file every single time, even with the links with no relations to the old, erased forum.
Or, you can keep the /oldforum/ directory, and put inside a .htaccess to permanently redirect all requests to the /newforum/, where we have this 404.php file...
Jerry
08-08-2008, 07:50 PM
You can set up the rest as you wish, if the link isn't found it defaults to the standard 404 file, if you want to parse the content to find if it's old forum or not before the script that's just another way of doing it, you can .htaccess and only direct old forum links to it if you want, that would lower the dB load onto the webserver.
This script is just an example and works for most, though not the only and de facto way of doing it.
The resulting 301 will update the search engines over time as it is.
diosrl
08-08-2008, 08:13 PM
you can .htaccess and only direct old forum links to it if you want, that would lower the dB load onto the webserver. YES this is exactly what I was thinking!
Anyway, it's a great feature for future impex releases! At least support for 2-3 forums like phpbb, invision, etc.
tommythejoat
08-10-2008, 05:16 PM
Since I don't have ready access to the domain name server, I tried to put a .htaccess redirect on the "from" board and hoped that the vBulletin board would capture the inbound requests and redirect them.
The redirect experiment did not go well. I could not get the behavior I was looking for on either end.
This is the contents of the .htaccess file located on the bbv2 site:
# bbv2 assigns .boy .pm and .cgi to the cgi-script handler in Apache
# Trailing slash references to nawcc-mb.com/bbv2/
AddHandler cgi-script .boy .pm .cgi
DirectoryIndex bbBoard.cgi bbBoard.cgi
# vBulletin message board has a 404 redirect to map bbv2 references to vBulletin references
# The bbBoard.cgi reference will be trapped by the 404 handler on mb.nawcc.org - disable until ready
Redirect permanent /bbBoard.cgi http://mb.nawcc.org/bbv2/bbBoard.cgi
I expected this to catch the reference to bbBoard.cgi and send it to mb.nawcc.org. The top two directives were already in the .htaccess file.
I put the 404 trap handler on mb.nawcc.org and edited the .htaccess file there to read:
ErrorDocument 404 /var/www/html/404t.php
php_flag log_errors on
php_value error_log /var/www/html/php_error.log
I had already been using the php error log to debug the migration software.
I tried changing the path for 404t.php to just "/" and to nothing but the file name as well as the form shown in the code box.
References to the old board are not redirected, they just display the old board.
If I edit the reference on my browser address line to substitute the new board address, I just get a 404 error. If I directly reference mb.nawcc.org/404t.php, the debug message prints when I turn on debug. With debug off, I get a 500 error, but nothing in the php error log.
Can someone tell me how the .htaccess files should be set up? I am stuck at this point.
:confused:
tommythejoat
08-15-2008, 07:57 PM
I have the trap handler working on the new board. If I copy a url from the old board and edit the domain to be the new board everything works as expected.
However, I still have not figured out how to get the old board to do the redirect. The directive looks so simple, but it is not working.
The contents of the .htaccess file on the old system is in the post just above this one. I have looked in httpd.conf and I can't see anything that would prevent the redirect from working.
The behavior is that references to the old message board look totally unchanged and just invoke whatever page is referenced.
SeV3n
08-28-2008, 10:24 AM
Hi Jerry. There is an error at line 92.
$old_thread_script = "showthread{$old_ext_type}?p=";
must be
$old_thread_script = "showthread{$old_ext_type}?t=";
tommythejoat
08-28-2008, 07:48 PM
Just a follow up to close my problem discussion.
The .htaccess file needed to be in the web root directory in order to redirect traffic. I was confused because the old message board software had an .htaccess in the top of the message board directory (one below the root) that was catching references and doing a cgi handler.
In any case it is working fine now. Attempts to reference the old board get redirected to the new board (different site) where the trap handler interprets them and delivers the correct thread or forum.
We had this board installed on May 22nd and will be finally going live on Sep 3rd.
trigatch4
09-08-2008, 10:04 PM
Could somebody help me for modifying the script for SMF 1.1.5? I'm using "search engine friendly URLs" so they should be pretty easy to parse for someone who knows what they are doing (I clearly don't)
Forums look like this:
http://mysite.com/index.php?board=5.0
Threads look like this:
http://mysite.com/index.php/topic,775.0.html
Posts look like this:
http://mysite.com/index.php/topic,542.msg3252.html#msg3252
In addition, I'm not fully sure how to RUN/OPERATE this? There is a 404.php and it tells you to add a line in your new forum/db but how do you execute/initiate everything?
Thanks in advance for your help!
tommythejoat
09-08-2008, 10:38 PM
I have been working on this for a different source system than yours, but I may be able to offer a couple of tips.
1. You need to be able to parse off the old id code for anything you want to serve on redirect.
Your forum and thread links appear to be exactly the same and neither has an identifier, so I don't think those will do you any good. Perhaps you copied the wrong thing.
2. The 404 trap program needs to find the code from the old reference that was translated to an equivalent code in the vBulletin system.
In your case this looks like either the numeric part of the topic .html file name or the message number in that file. In either case if you can find a unique string that ALWAYS preceded the critical identifier, you can use the php intval function to return that number as show in the examples in Jerry's 404 program.
The number or numbers you get by this technique need to be the ones that ImpEx previously deposited in the ImportID column of the Thread, Forum or Post table.
When you have these numbers you can use them in mySQL queries to find out what the equivalent number is in vBulletin.
If you have never done any programming in PHP or any other language, you probably have little chance of accomplishing any of this. If you have had some basic programming experience, you should be able to follow it with a fair bit of work.
Once the 404.php program is built to do the translation trick, you need to use .htaccess to call the program when your web site would have reported a 404 File not Found error. The .htaccess file needs to be in the directory that is trying to display the missing file.
ErrorDocument 404 /trap404.php
php_flag log_errors on
php_value error_log /var/www/html/php_error.log
This is the file I am using. I found it convenient to turn on php error reporting as well as using the ErrorDocument directive to turn on the trap.
trigatch4
09-08-2008, 10:47 PM
Indeed, I copied/pasted wrong but fixed above. Threads look like this:
http://mysite.com/index.php/topic,775.0.html
I have pretty much no programming experience so while appreciate your valiant effort, it doesn't look like I'll get very far although I'm going to give it a try.
trigatch4
09-12-2008, 02:46 AM
A friend took a look and here is what they came up with. I'm hoping someone can go over it and see if it is okay as I can't really "test" the 301 redirect until I'm live with the new site. Greatly appreciate your help
This sets the variables we use below to determine if we need to parse the old urls.
case 'smf'
$old_forum_script = "index.php?board="; //http://mysite.com/index.php?board=5.0
$old_thread_script = "index.php/topic,"; //http://mysite.com/index.php/topic,775.0.html
$old_post_script = ".msg"; //http://mysite.com/index.php/topic,603.msg6020.html#new
$old_user_script = "index.php?action=profile,u="; //http://mysite.com/index.php?action=profile;u=41
break;
This is the actual parser.
Forum Link - Tell it to grab the querystring value for 'board'
// It's a forum link
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_forum_script}") === 0)
{
$action = 'forum';
$old_id = intval($_GET['board']);
$sql = "SELECT forumid FROM {$tableprefix}forum WHERE importforumid={$old_id}";
}
Thread Link - Tell it to grab the int value for thread id
// It's a thread link
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_thread_script}") === 0)
{
$action = 'thread';
// Cuts 775 out of this : /index.php/topic,775.0.html
$old_id = intval(substr(substr($_SERVER['REQUEST_URI'], 17), 0, strpos(substr($_SERVER['REQUEST_URI'], 17), '.')));
$sql = "SELECT threadid FROM {$tableprefix}thread WHERE importthreadid={$old_id}";
}
Post Link - Tell it to grab the int value for post
// It's a post link
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_post_script}") === 0)
{
$action = 'post';
// Cuts 6020 out of this /index.php/topic,603.msg6020.html#new
$old_id = (substr(substr($_SERVER['REQUEST_URI'], intval(strpos(substr($_SERVER['REQUEST_URI'], 0), '.msg')) + 4), 0, strpos(substr($_SERVER['REQUEST_URI'], intval(strpos(substr($_SERVER['REQUEST_URI'], 0), '.msg')) + 4), '.')));
$sql = "SELECT postid FROM {$tableprefix}post WHERE importpostid={$old_id}";
}
User Link - Tell it to grab the int value for users profile
// It's a user link
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_user_script}") === 0)
{
$action = 'user';
// Cuts 41 out of this : index.php?action=profile;u=41
$old_id = intval(substr($_SERVER['REQUEST_URI'], 28, 4));
$sql = "SELECT userid FROM {$tableprefix}user WHERE importuserid={$old_id}";
}
tommythejoat
09-12-2008, 11:59 PM
I looked over the code and it looks fine to me. There is one nuance that is not really important. When you are using intval to parse a number from a string, you don't need to snip off the number, you just need to start at the right place and intval will stop converting when it finds a non-numeric character.
While we are discussing this, I decided I needed to move the importid's into their own table and built this table:
CREATE TABLE `importedid` (
`idtype` VARCHAR( 25 ) NOT NULL,
`oldid` INT UNSIGNED NOT NULL,
`newid` INT UNSIGNED NOT NULL,
PRIMARY KEY (`idtype`, `oldid`)
) TYPE = MYISAM;
I then populated the table from the importids of each of the imported tables assigning the values post, thread, forum, attachment and user to the idtype field. Here is an example of one of the queries I used to do this.
INSERT INTO `importedid` (`idtype`, `oldid`, `newid`)
SELECT "attach", `importattachmentid`, `attachmentid`
FROM `attachment` WHERE `importattachmentid`>0
The sql that I am trying to use to query this table is:
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_thread_script}") === 0)
{
$action = 'thread';
$old_id = intval(substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], ';gtid=')+6)); //to the end of the string
if (strpos($_SERVER['REQUEST_URI'], ';pagenumber='))
{
$page = intval(substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], ';pagenumber=')+12));
}
$sql = "SELECT newid FROM {$tableprefix}importedid WHERE oldid={$old_id} AND idtype = {$action}";
When I copy this up and enter a url for the old board in my browser, it fails to find the new id. The result is the code 10 id not found no matter what I enter. I am guessing there is something wrong with the $sql, but I cannot figure out what it might be. I would appreciate any advice. I can't see why this doesn't work and maybe I am just too close to it. The board is live now and I don't want to take it down to play with this.
The older version that takes the id's out of the various importid's in the tables works just fine. I put it back each time I try to fix the above with a new idea and the new idea does not work. :confused:
trigatch4
09-14-2008, 04:56 PM
You need the SQL database for this to work? Do I just point it to my existing SQL database that hosts the VB or do I need to make a new line and/or database separately?
I thought that the 404.php would dynamically parse the old URL and forward to a new URL based on the parsing self contained in the 404.php document. Am I wrong?
tommythejoat
09-14-2008, 05:28 PM
You need the SQL database for this to work? Do I just point it to my existing SQL database that hosts the VB or do I need to make a new line and/or database separately?
I thought that the 404.php would dynamically parse the old URL and forward to a new URL based on the parsing self contained in the 404.php document. Am I wrong?
The parser fetches the old id for whatever object it references. The object has a new id that it is using in the new vB. ImpEx puts the old id in the object tables with the new id and the program looks them up to do the translation.
If you use the basic approach, you cannot clean up your database and remove the importid's from it. This is generally not a big deal unless you are doing multiple imports.
I just wanted to clean it up by moving the importid's into a separate table.
I also added some other external reference url's that had shown up in the log table. I decided that those url's for attachments, printthread requests, etc. should also be translated appropriately.
I also made the url for items that are not found be a thread on my message board talking about the trap facility.
trigatch4
09-14-2008, 08:09 PM
UPDATE: everything seems to work properly except ONE HUGE THING:
nothing after /index.php/ triggers a 404 but rather loads the forum index at whatever URL is input. All of SMF's urls come after /index.php which makes this a huge disaster.
I'm not sure why this is happening. Error reporting doesn't help because the 404 is never triggered to begin with. Anyone?
jca2112
10-10-2008, 08:14 PM
I'm also having a similar problem. The 404.php simply redirects to the front page of the forums/index.php regardless of the link. The script doesn't seem to be seeing the URI request.
I assume it is because of the old IPB url versus the new VB url I'm using. I'm trying to forward to my current test environment. (IP and urls changed to protect the innocent.)
Old IPB link:
http://mysite.com/forums/index.php?showtopic=2400
should translate/forward to
New VB link:
http://192.168.2.1/~mysite/forums/showthread.php?t=47000
I assume the script is having trouble using an IP + ~home directory style link? Is that the issue? Turning on debug shows no results, so it's obviously not seeing the urls.
Any ideas? Appreciate any help/info.
jca2112
10-16-2008, 08:01 PM
Hmm. It looks like vBulletin isn't passing on a 404 error because the old url is pointing to "index.php?showtopic=", and vBulletin will automagically display "index.php" regardless of the "?showtopic=". Is there any way to stop vBulletin from doing this so it will properly call the 404.php file?
tommythejoat
10-16-2008, 09:48 PM
It sounds like you are not pointing to a missing file.
It is critical that the old url resolve to a different location than the new message board. In the absence of that you will not get a 404 "missing file" error.
If the old message board is also vBulletin and you put the new one in the same location, you cannot get a 404 message and therefore cannot trap it.
jca2112
10-16-2008, 10:24 PM
I'm guessing it has to do with this IPB (Invision Power Board) issue (http://www.vbulletin.com/forum/showthread.php?p=1367426#post1367426) with the 404 redirection script.
Jerry
10-27-2008, 08:35 PM
Hmm. It looks like vBulletin isn't passing on a 404 error because the old url is pointing to "index.php?showtopic=", and vBulletin will automagically display "index.php" regardless of the "?showtopic=". Is there any way to stop vBulletin from doing this so it will properly call the 404.php file?
Yes, the regexs where the URL is parsed can be changed to take care of that.
raymondblog
11-04-2008, 02:04 AM
Jerry, can you make it to support PunBB?
Jerry
11-04-2008, 04:12 AM
I'd guess the phpBB2 settings would work.
newsoftw
11-15-2008, 10:02 AM
i import my forum from phpbb 3.0.2 to VB 7.3.4 ...
can it work on as a phpmm 3.0.2 importing...
if it working so how to install it..
thanks in ADVNS
new soft world
Divvy
12-18-2008, 02:35 AM
Hi everyone,
Can someone help me? I have installed this mod but dont know if is working...
My old forum: http://www.viciadosnosexo.com (ADULT)
My new forum: http://www.viciadosnosexo.com/forum/ (ADULT)
Try to write this in google:
site:viciadosnosexo.com
And click in a link that ends in .html
It is working? Or not?
Also one thing... the 404_actions table is empty for a while. It is normal?
Please help me fixing this...
Thank you!
cooltechie
01-21-2009, 04:51 PM
I'm sorry. What exactly do I do? Just edit paths and copy the 404.php to the root and that's it? Please provide more details. Thanks!
brandonroy
02-06-2009, 10:43 AM
I need help too. My old forums were powered by smf 1.1.7. I need some help on how to set this up! I'm lost and Google is going to spit on my site!
project-Buckfas
02-16-2009, 10:56 AM
I'm hoping to obtain the same thing as you guys.
I don't fancy adding every page on my site to the .htaccess for a 301 redirect.
Mainly because of the time consumption!
Jerry
02-20-2009, 04:36 AM
Well there is going to be a major change to this script soon as I'm going to be dealing with ImpEx2 soon that that will be using a separate MEMORY table that stores all the source/target id's (basically foreign keys with source import id).
This will allow for multi import 301 re-directs as there will be now the concept of a phase id, which is a new id for each whole form import. i.e. each merge import you do is a phase and has it's own ID. (p.s. yes this will allow for differential imports ;) ).
There has been enough major boards and requests for this now. i.e. if one board assimilates 4 others with 4 merge imports, they will want 4 unique 301 handlers. And so they will be 4 phase id's to handle that.
Also to address the "Hey you only hard coded a few systems, mine isn't supported" ..... I'm going to try to add a drop in module system, much the same as impex itself that will allow for something along the lines of : "Ah, phase 2 is a phpBB3 -> vB import, I'll set the phase id in the 301 config file and drop in the module for 301 that is set for my urls". So then you can ensure that systems are supported. I'm guessing that the Tier 1 systems will be handled with logging so you'll get viability of the amount of SE redirects.
ForumUser210
02-20-2009, 06:09 AM
created my own solution.
Thanks
paintballer.ie
02-22-2009, 02:44 PM
Hi,
This is what I am looking for, i am about to convert over to vb from phpbb2.
Are these steps still correct for vb 3.8.1
lazydesis
02-26-2009, 06:37 PM
I imported from old vB to new version using Impex, and had the same problem. All threadIDs were different from what they were in my old forum, because I deleted some threads in between.
However instead of using the 404 method, I deleted the "threadid" column in my database and renamed the "importthreadid" column as "threadid"
Now all my threads are having same "threadid" as previous forum
Can anyone tell me if this has any adverse affects or what I did is wrong? Everything seems to working fine and it took me just 5 mins to do this.
What's the advantage of using the 404 method described in this thread?
Thanks.
EDIT: Its actually not working properly. Can someone tell me if its possible to change the new ids with the ones in the importids column and would this work ?
project-Buckfas
02-27-2009, 10:04 AM
Any help with the code for smf 1.x.x ?
I'm hoping to go live with my vb soon as I'm pretty much done customising it
paintballer.ie
03-01-2009, 08:47 AM
I'm sorry. What exactly do I do? Just edit paths and copy the 404.php to the root and that's it? Please provide more details. Thanks!
yes, more info please. I saw raference to a readme.txt what was made, but could not find it.
what does one do with the lines below, as it says to customise?
$old_id = 0;
$action_code = 0;
$action = null;
$sql = null;
$page = null;
$postcount = null;
// Get the file names and types
paintballer.ie
03-02-2009, 09:17 PM
I have phpbb2 installed in the root folder and I will be instaling vbulletin in the root folder,
Will this work?
paintballer.ie
03-04-2009, 09:28 PM
When I try this is redirects to the normal 404.shtml file I have.
Then in debug mode:
Action ::
SQL ::
REQUEST_URI :: /vbtest/404.php
Any thoughts?
i like this mod - even if it is "unsupported"
i've been thinking -
perhaps it may also be useful if (in addition to the logging) we could make use of the moderator queue or report post. this way the mods can edit the posts, refer to the notes of the mod queue which shows the link to the new database id - then edit the post and release from the queue.
this could potentially alleviate the extra db load this script is using on the server.
another option is to provide an admincp script that lists the log - which can be used to edit posts.
45wheelgun
06-09-2009, 01:26 AM
Has anyone used this in a move from EVE to VB? It seems like it is pretty straight forward, I am just unclear where these variables go:
Forum http://www.oldforum.com/eve/forums/a/frm/f/540103904
Thread http://www.oldforum.com/eve/forums/a/tpc/f/540103904/m/241103031
User http://www.oldforum.com/eve/personal?x_myspace_page=profile&u=4131095313
Main http://www.oldforum.com/eve/
Can anyone give me a hand or point me in the right direction?
Thanks,
Dave
final kaoss
10-19-2009, 12:37 AM
I can use one for MyBB 1.4
Ghostt
10-25-2009, 01:40 PM
Does it work with phpbb3?
i had phpbb seo url rewrite mod installed , how to redirect the urls?
Ghostt
10-30-2009, 09:14 PM
i really need a phpbb3 redirect 404 script!!! please its important . the most users here coming from phpbb3 share please youre code!!!!
kydyl
12-07-2009, 05:35 PM
This might be the best thing ever!!!
The main reason that I have put up the move to vbulletin from my old forum (punbb) has been the URL issue.
When I finally decided to migrate I thought I would need to hack something myself and then I find this :D:D
Extra PC
01-02-2010, 07:03 AM
Hello
i don't know how to use it
where i can put it?
do the import from phpbb3 to vb4 and then use it or what?
and can i try it on local server?
xsasox
01-04-2010, 09:17 AM
please i want file like (404.php) support old system ( mybb )
the 404.php here supported : 'phpBB2' 'ubb.threads' 'vb3' 'ipb2'
plz help me
i'am waite
xsasox
01-05-2010, 08:13 AM
plz help me
xsasox
01-05-2010, 08:55 PM
i'am waite
xsasox
01-07-2010, 09:30 PM
plz help me
hiker
01-30-2010, 05:41 PM
Hi, I haven't tried this yet, I'm importing a phpbb2 to VB 4.0.1
Do I import with Impex first, and then run this script?
And... where does this 404.php file go, which folder?
Thanks.
nestortoledo
03-19-2010, 08:23 PM
Any way to use it with Smf 2.0?
I want to redirect my old SMF URLS, to my new vbulletin Urls.
I can help to test it,
The urls of smf are like this
BOARDS: index.php?board=XX
TOPICS: index.php?topic=371036.0
USERS: index.php?action=profile;u=236193
pitrow
03-20-2010, 10:36 PM
for those asking for phpbb3, this script will work for that with a few mods.
I successfully used it this weekend for a phpbb3 -> vb4 CMS swap. Works just fine.
pitrow
04-13-2010, 09:26 PM
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
$old_folder = 'phpBB/';
to
$old_folder = 'forum/';
change
$standard_404 = 'http://www.example.com/not_found.html';
to
$standard_404 = 'http://www.mydomain.com/404.shtml';
this points to my existing 404 file
change
$new_domain = 'example';
to
$new_domain = 'www.mydomain.com';
change
$new_folder = 'vBulletin/';
to
$new_folder = '';
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
switch ($old_system)
{
case 'phpBB2' :
change
$old_thread_script = "viewtopic{$old_ext_type}?t=";
to
$old_thread_script = "viewtopic{$old_ext_type}?f=";
inside
// It's for the old forum
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}") === 0)
{
switch ($old_system)
{
case 'phpBB2' :
find
$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:
$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:
ErrorDocument 404 /404.php
I also deleted everything from the "forum" directory and uploaded an index.php file there that contains this:
<?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.
napy8gen
04-14-2010, 04:57 PM
I couldnt get the topic redirection right, only for members.
the example old link in google always in this format:
www.siasat.pk/forum/viewtopic.php?f=34&t=12541
I am using basic friendly urls, this is new vb4 features.
the url generated by it something like this. notice there is only topic number.
http://www.siasat.pk/forum/showthread.php?34243-Going-Blackwater.
any help Pitro would be great.
adeel80
04-15-2010, 08:14 PM
I couldnt get the topic redirection right, only for members.
the example old link in google always in this format:
www.siasat.pk/forum/viewtopic.php?f=34&t=12541
I am using basic friendly urls, this is new vb4 features.
the url generated by it something like this. notice there is only topic number.
http://www.siasat.pk/forum/showthread.php?34243-Going-Blackwater.
any help Pitro would be great.
I am exactly having the same problem. Can someone please reply.
CRDeveloper
08-24-2010, 01:49 AM
Thanks!!
I've upgrade a phpBB 3.0.7 forum to vBulletin 4.0.6 PL1 successfully. Redirects working fine!!!
BrightStar
08-28-2010, 11:43 AM
Thanks!!
I've upgrade a phpBB 3.0.7 forum to vBulletin 4.0.6 PL1 successfully. Redirects working fine!!!
Could you please help me doing that as well?
I've upgraded from phpBB but it was with SEO Mod to vBulletin. Now struggling to understand what I am supposed to do.
traen
02-05-2011, 03:15 PM
Does this work with several types of old forums at once, or are you limited to using one at a time?
futurist
02-09-2011, 05:38 PM
No updates for SMF ?
I appreciate the work.
But including only a few boards is not good enough.
Regards
MarpeX
06-13-2011, 07:25 AM
I imported from old vB to new version using Impex, and had the same problem. All threadIDs were different from what they were in my old forum, because I deleted some threads in between.
However instead of using the 404 method, I deleted the "threadid" column in my database and renamed the "importthreadid" column as "threadid"
Now all my threads are having same "threadid" as previous forum
Can anyone tell me if this has any adverse affects or what I did is wrong? Everything seems to working fine and it took me just 5 mins to do this.
What's the advantage of using the 404 method described in this thread?
Thanks.
EDIT: Its actually not working properly. Can someone tell me if its possible to change the new ids with the ones in the importids column and would this work ?
I have exactly the same question. My former board was a vB 4 from which I imported all the threads, posts and users to a news vB 3.8.6. Now the IDs in the URLs like http://www.domain.de/forum/category/1234-thread-title.html are not the same like in the old vB 4 board. What can I do?
licensinglinks
10-25-2011, 06:41 PM
OK I'm in a bit of a panic. I just switched from phpBB3 to vBulletin and all my Google links have totally screwed up. This have resulted in traffic I've carefully built up for 2 years going off the edge of a cliff. I had no idea that this would happen!!!
Here's an example of a link that comes up in google to my old phpBB board.
http://www.mechanicaldesignforum.com/forum/viewtopic.php?f=39&t=117
However, since switching to vBulletin the new link has changed to:
http://www.mechanicaldesignforum.com/forum/showthread.php?69-female-mechanical-designers
Someone pointed me to this thread, but setting this solution up seems WAY beyond my abilities. I feel totally stuck.
Can anyone explain to me a step-by-step guide how to solve my problem. And please explain it to me like I'm 2 years old because I'm not joking - I really don't have a clue what to do and where to start.
I would really appreciate some help. I really need to get this fixed fast so my Google ranking doesn't get destroyed.
tommythejoat
10-25-2011, 08:51 PM
The Impex program re-indexes all the threads it imports. It does not really care what the source forum product was. The old index is save in a column with threads, posts, profiles, etc. for each item that was imported.
For any given solution, you do not need all the generality that is in the 404 trap. You just need to know where to find the old threadid in the url that has been trapped because the target was not found.
That threadid is then used to look up the new threadid in the vBulletin database and the new threadid is used to compose a URL for the imported thread.
It is not just Google that needs this help. All the internal references to other threads, images, etc. on your old message board still reference the old url's also. Unless you write a query to edit all of those references to current correct thread references, they will be handled by the 404 trap also.
On my board, I removed the translation id's from the content tables and put them into their own table. I also created a log table that keeps track of the translations so I could see what the traffic was and when some references were not trapped properly.
Since vBsolutions wrote the original code, I don't think I am free to post it here.
thecoo1est
05-21-2012, 02:50 PM
Does this also work with 4.1.12? I just purchased vb today and I really want to figure everything out before I convert from smf to vbulletin, thanks.
BasilFawlty
11-03-2012, 03:46 PM
I am running UBB.Threads, but using "Search Engine Friendly" URLs. Is it possible to modify this script to properly parse threads, forums, profiles when my URLs for each look like this:
forum:
http://www.example.com/forum/ubbthreads.php/forums/5/1/introductions
thread (with unread posts):
http://www.example.com/forum/ubbthreads.php/ubb/showflat/Number/878325/gonew/1/Help_I_Need_help#UNREAD
OR (if its a thread that has no unread posts):
http://www.example.com/forum/ubbthreads.php/topics/878325/Help_I_Need_help#Post878325
User Profile:
http://www.example.com/forum/ubbthreads.php/users/5179/fredschmertz
I'm getting ready to move a UBB.Treads forum that I've ran for 12 years to VBulletin. Would really appreciate any help with how to ensure that any old threads in Google are properly redirected to the correct new threads once I do the import.
michaelstoffer
02-26-2014, 03:38 PM
Would anyone have an idea on how to get this script to work if the URL structure had been changed from http://www.eaxample.com/forums to http://forums.example.com? This is something that I have been fighting with for a couple days now and can't seem to figure it out.
adigetr
06-30-2014, 03:27 PM
I need to for SMF to vbulletin ?
Anyone help me please ?
I used pretty url SMF
Now I use vb 3.8.4 and vbseo
I need to 301 redirect old SMF links please help me.
Thanks.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.