Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
404 / 301 after import redirect on import ids Details »»
404 / 301 after import redirect on import ids
Version: 1.00, by Jerry Jerry is offline
Developer Last Online: Oct 2010 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 3.6.9 Rating:
Released: 04-22-2008 Last Update: Never Installs: 52
Re-useable Code  
No support by the author.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 07-28-2008, 01:18 PM
jbeam jbeam is offline
 
Join Date: Mar 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone have any ideas?
Reply With Quote
  #13  
Old 07-29-2008, 02:07 PM
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Location: Boston
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #14  
Old 07-29-2008, 06:11 PM
Deepdog009's Avatar
Deepdog009 Deepdog009 is offline
 
Join Date: Dec 2004
Location: Almost out of PHP TZone
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice!!!
Reply With Quote
  #15  
Old 07-30-2008, 01:02 PM
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Location: Boston
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Code:
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=.
Reply With Quote
  #16  
Old 07-30-2008, 10:14 PM
Jerry's Avatar
Jerry Jerry is offline
 
Join Date: Jun 2003
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jbeam View Post
Code:
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 :

PHP Code:
$old_folder     'phpBB/';     // With trailing slash
$old_ext_type    '.php';     // Including preceding dot 
Quote:
Originally Posted by tommythejoat View Post
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.

Quote:
Originally Posted by tommythejoat View Post
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

Quote:
Originally Posted by tommythejoat View Post
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 :

PHP Code:
// 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 :

PHP Code:
$old_folder "";
$old_thread_script "bbBoard.cgi?a=viewthread"
For :

PHP Code:
$_SERVER['REQUEST_URI'] = "/bbBoard.cgi?a=viewthread;fid=3;gtid=305734"
Quote:
Originally Posted by tommythejoat View Post
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.
Reply With Quote
  #17  
Old 07-30-2008, 10:19 PM
Jerry's Avatar
Jerry Jerry is offline
 
Join Date: Jun 2003
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Deepdog009 View Post
Nice!!!
With ice and a slice
Reply With Quote
  #18  
Old 07-30-2008, 10:48 PM
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Location: Boston
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.

Now if I could just get a response to my cleaner questions on the vbulletin.com community forum I would be good to go.
Reply With Quote
  #19  
Old 07-31-2008, 12:05 PM
jbeam jbeam is offline
 
Join Date: Mar 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.

Code:
#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
Reply With Quote
  #20  
Old 08-01-2008, 05:22 PM
Jerry's Avatar
Jerry Jerry is offline
 
Join Date: Jun 2003
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you set up the logging table in MySQL ? Does it have any entries for the profiles ?
Reply With Quote
  #21  
Old 08-04-2008, 12:36 PM
jbeam jbeam is offline
 
Join Date: Mar 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:42 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09217 seconds
  • Memory Usage 2,329KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (4)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete