Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
404 / 301 after import redirect on import ids Details »
404 / 301 after import redirect on import ids
Mod Version: 1.00, by Jerry (Member) Jerry is offline
Developer Last Online: Oct 2010 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 3.6.9 Rating: (10 votes - 4.80 average) Installs: 50
Released: 23 Apr 2008 Last Update: Never Downloads: 717
Not Supported Re-usable Code  

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.

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
  #16  
Old 31 Jul 2008, 00:19
Jerry's Avatar
Jerry Jerry is offline
 
Join Date: Jun 2003
Originally Posted by Deepdog009 View Post
Nice!!!
With ice and a slice
__________________
All the ImpEx are belong to us.
Reply With Quote
  #17  
Old 31 Jul 2008, 00:48
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Real name: Tom McIntyre
Thumbs up

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
  #18  
Old 31 Jul 2008, 14:05
jbeam jbeam is offline
 
Join Date: Mar 2008
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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #19  
Old 01 Aug 2008, 19:22
Jerry's Avatar
Jerry Jerry is offline
 
Join Date: Jun 2003
Have you set up the logging table in MySQL ? Does it have any entries for the profiles ?
__________________
All the ImpEx are belong to us.
Reply With Quote
  #20  
Old 04 Aug 2008, 14:36
jbeam jbeam is offline
 
Join Date: Mar 2008
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
  #21  
Old 04 Aug 2008, 20:36
Jerry's Avatar
Jerry Jerry is offline
 
Join Date: Jun 2003
Originally Posted by jbeam View Post
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.
__________________
All the ImpEx are belong to us.
Reply With Quote
  #22  
Old 08 Aug 2008, 21:39
diosrl diosrl is offline
 
Join Date: Mar 2005
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...

Last edited by diosrl; 08 Aug 2008 at 21:48.
Reply With Quote
  #23  
Old 08 Aug 2008, 21:50
Jerry's Avatar
Jerry Jerry is offline
 
Join Date: Jun 2003
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.
__________________
All the ImpEx are belong to us.
Reply With Quote
  #24  
Old 08 Aug 2008, 22:13
diosrl diosrl is offline
 
Join Date: Mar 2005
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.
Reply With Quote
  #25  
Old 10 Aug 2008, 19:16
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Real name: Tom McIntyre
Question Problems with .htaccess

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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.
Reply With Quote
  #26  
Old 15 Aug 2008, 21:57
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Real name: Tom McIntyre
Unhappy

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.
Reply With Quote
  #27  
Old 28 Aug 2008, 12:24
SeV3n SeV3n is offline
 
Join Date: Jan 2004
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=";
Reply With Quote
  #28  
Old 28 Aug 2008, 21:48
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Real name: Tom McIntyre
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.
Reply With Quote
  #29  
Old 09 Sep 2008, 00:04
trigatch4 trigatch4 is offline
 
Join Date: Feb 2007
Question

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,54...2.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!

Last edited by trigatch4; 09 Sep 2008 at 00:44.
Reply With Quote
  #30  
Old 09 Sep 2008, 00:38
tommythejoat's Avatar
tommythejoat tommythejoat is offline
 
Join Date: Apr 2008
Real name: Tom McIntyre
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.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

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


New To Site? Need Help?

All times are GMT. The time now is 12:41.

Layout Options | Width: Wide Color: