External incoming links

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry
    Senior Member
    • Dec 2002
    • 9137
    • 1.1.x

    #76
    This will never be supported and direct manipulation of the auto_inc isn't going to be supported due to merge imports, where id's will already exist.
    I wrote ImpEx.

    Blog | Me

    Comment

    • Cars2007
      Member
      • Jun 2007
      • 31
      • 3.7.x

      #77
      Originally posted by Jerry
      The 404/301 script can be used to redirect internal/external vBulletin links that have changed, it's one more step for the look up, though the 301 will update search engines and the older data will fade and the newer will have the new links and be fine.
      Well, suppose the old board has threadids as high as 1500, but 100 of them were deleted or invalid in some way so the max thread ID ImpEx creates is 1400. I open the board and people start posting. How does it know the difference between thread 1450 (on the old board) and thread 1450 (on the new board)?

      The auto increment adjustment is a bit wierd and not something I'd expect you to put into ImpEx. I just want to see if I can do it myself.

      Comment

      • Jerry
        Senior Member
        • Dec 2002
        • 9137
        • 1.1.x

        #78
        Originally posted by Cars2007
        Well, suppose the old board has threadids as high as 1500, but 100 of them were deleted or invalid in some way so the max thread ID ImpEx creates is 1400. I open the board and people start posting. How does it know the difference between thread 1450 (on the old board) and thread 1450 (on the new board)?
        The old threads will be looked up on importthreadid then redirected to the new threadid, any link that doesn't find a page will be passed to the 301/404 script and then lookup on the import id's.

        Originally posted by Cars2007
        The auto increment adjustment is a bit wierd and not something I'd expect you to put into ImpEx. I just want to see if I can do it myself.
        Possibly, I've seen a few try it, though it's really not something I want to promote or talk about here as it's a recipe for disaster.
        I wrote ImpEx.

        Blog | Me

        Comment

        • Cars2007
          Member
          • Jun 2007
          • 31
          • 3.7.x

          #79
          I came up with a happy medium for cases in which vBulletin is imported to vBulletin. This lets your members take a stale pre-ImpEx link, like this:

          ...and change 'show' to 'old', so they get this:


          This has to be done BEFORE the ImpEx import IDs are dropped.

          First, create a table to map the old to the new:
          Code:
          CREATE TABLE `legacy_thread` (
                 `oldThreadID` int(10) unsigned NOT NULL,
                 `newThreadID` int(10) unsigned NOT NULL,
                 PRIMARY KEY (`oldThreadID`)
               ) ENGINE=InnoDB;
          Then, copy the IDs into it:

          Code:
          insert into legacy_thread select importthreadid,threadid from thread;
          Finally, create a file 'oldthread.php' in the forum root directory:
          Code:
          <?php
          // Use this at your own risk.
          // ####################### SET PHP ENVIRONMENT ###########################
          error_reporting(E_ALL & ~E_NOTICE);
          
          // #################### DEFINE IMPORTANT CONSTANTS #######################
          define('NO_REGISTER_GLOBALS', 1);
          define('THIS_SCRIPT', 'oldthread'); // change this depending on your filename
          
          // ######################### REQUIRE BACK-END ############################
          require_once('./global.php');
          
          // #######################################################################
          // ######################## START MAIN SCRIPT ############################
          // #######################################################################
          
          $oldThreadID = $vbulletin->input->clean($_REQUEST["t"], TYPE_INT);
          
          $sql = $db->query_read(
                  "SELECT newThreadID FROM " . TABLE_PREFIX . "legacy_thread WHERE oldThreadID='$oldThreadID'"
          );
          
          $result = $db->fetch_Array($sql);
          
          $no_thread_URL = "{$vbulletin->options[bburl]}";
          
          if($result[newThreadID]) {
                  header("HTTP/1.1 301 Moved Permanently");
                  header("Location: showthread.php?t=$result[newThreadID]");
          } else {
                  echo "<META HTTP-EQUIV='Refresh' CONTENT='0; $no_thread_URL'>";
          }
          
          ?>
          After that, you simply change 'show' to 'old' in a stale link and it'll bounce you to the right thread. It might be possible to use the cleaner supplied with ImpEx to preemptively do this to all references in your forum, but I haven't tried it so I don't know if it would work.

          Comment

          • Jerry
            Senior Member
            • Dec 2002
            • 9137
            • 1.1.x

            #80
            A handy way of doing it, you can support multi imports with that too.
            I wrote ImpEx.

            Blog | Me

            Comment

            • quasar
              Member
              • Aug 2007
              • 83
              • 5.0.0

              #81
              I'm trying to get my 404 page setup, but coming across problems.

              My old forum was in the root directory, my new one in a subdomain.

              I've setup my 404.php command like such:

              PHP Code:
              // Domain
              // Example :: http://www.example.com/phpBB/

              $old_folder     '/';                                 // With trailing slash
              $old_ext_type    '.php';                                     // Including preceding dot
              $standard_404     'http://www.example.com/404.shtml';     // The usual 404 that this script replaces

              // Example :: www.example.com/vBulletin/

              $new_domain     'http://www.example.com';
              $new_folder        'forum/';    // With trailing slash
              $ext_type        '.php';         // File extension type that vBulletin is using, i.e. index.php including the preceding dot 
              Is that right, or should $old_folder be http://www.example.com/ ?

              I've uploaded the .htaccess both to the root directory (where the old forum was) and the forum folder.

              404.php is in the forum folder.

              .htaccess:

              PHP Code:
              ErrorDocument 404 /forum/404.php 
              Is that setup right, or am I doing something wrong? The redirects aren't working on what I've tested so far.

              Thanks in advance.

              Comment

              • quasar
                Member
                • Aug 2007
                • 83
                • 5.0.0

                #82
                I've updated a lot of details (removed the subdomain in case that was causing problems) and now everytime I click a link it goes direct to the 404.htm page.

                I ran the SQL query listed in the help file and get the result that no files are recorded. It clearly isn't redirecting through the 404.php, and I'm now at a complete loss.

                Any suggestions?

                Comment

                • fredang85
                  New Member
                  • Sep 2007
                  • 17

                  #83
                  It was working initially, until it stopped working yesterday, maybe after installed a vRewrite (seo script) plugin.

                  but i uninstalled it as it was giving problems.

                  but now, i'm unable to redirect. on debug=true, i get

                  Action :: thread
                  SQL :: SELECT threadid FROM vBull_thread WHERE importthreadid = 13197
                  REQUEST_URI :: /forums/viewtopic.php?t=13197

                  so why does it go to my not_found?

                  www.motorolafans.com
                  Last edited by fredang85; Sat 29 Sep '07, 1:46pm. Reason: I solved this. My databse was wrong

                  Comment

                  • fredang85
                    New Member
                    • Sep 2007
                    • 17

                    #84
                    i would like to forward my attachment links as well

                    is this correct?

                    // It's a download link
                    if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_attachment_script}") === 0)
                    {
                    $action = 'attachment';
                    $sql = "SELECT attachmentid FROM {$tableprefix}attachment WHERE importattachmentid = " . substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?id=')+3);
                    }




                    case 'download':
                    $new_url = "http://{$new_domain}/{$new_folder}showpost{$ext_type}?attachmentid=" . $row[0];
                    if ($postcount)
                    {
                    $new_url = "http://{$new_domain}/{$new_folder}attachment{$ext_type}?attachmentid=" . $row[0];
                    }
                    $action_code = 5;
                    break;


                    I did this but my debug was funny:


                    Action :: download
                    SQL :: SELECT attachmentid FROM vBull_attachment WHERE importattachmentid = =2955
                    REQUEST_URI :: /forums/download.php?id=2955

                    why is there = =2955?

                    Comment

                    • fredang85
                      New Member
                      • Sep 2007
                      • 17

                      #85
                      One more thing - My link was



                      but its not converting properly.

                      I ran debug and got this:

                      Action :: thread
                      SQL :: SELECT threadid FROM vBull_thread WHERE importthreadid = orums/viewtopic.php?t=4371
                      REQUEST_URI :: /forums/viewtopic.php?t=4371&postdays=0&postorder=asc&start=0

                      Whats wrong?

                      Comment

                      • AffGuardDog
                        Senior Member
                        • Apr 2007
                        • 115

                        #86
                        I couldn't find any SMF version of this 404.php, is that possible?

                        My urls are like this:

                        Forum Post
                        xxxhttp://www.domain.com/forums/index.php?topic=226.0

                        Forum List (All Forums)
                        xxxhttp://www.domain.com/forums/index.php

                        Forum List (Specific Board)
                        xxxhttp://www.domain.com/forums/index.php?board=2.0

                        Member Profile
                        xxxhttp://www.domain.com/forums/index.php?action=profile;u=1



                        Not sure what else is needed

                        Thanks!
                        Last edited by AffGuardDog; Wed 10 Oct '07, 8:56am.

                        Comment

                        • Jerry
                          Senior Member
                          • Dec 2002
                          • 9137
                          • 1.1.x

                          #87
                          Originally posted by AffGuardDog
                          I couldn't find any SMF version of this 404.php, is that possible?

                          My urls are like this:

                          Forum Post
                          xxxhttp://www.domain.com/forums/index.php?topic=226.0

                          Forum List (All Forums)
                          xxxhttp://www.domain.com/forums/index.php

                          Forum List (Specific Board)
                          xxxhttp://www.domain.com/forums/index.php?board=2.0

                          Member Profile
                          xxxhttp://www.domain.com/forums/index.php?action=profile;u=1



                          Not sure what else is needed

                          Thanks!
                          Yes it can be done by the look of those URL's, you would just have to customise the script to pull out the numbers (which are the import ids).
                          I wrote ImpEx.

                          Blog | Me

                          Comment

                          • AffGuardDog
                            Senior Member
                            • Apr 2007
                            • 115

                            #88
                            ok - well, I hope I can figure it out

                            Comment

                            • quasar
                              Member
                              • Aug 2007
                              • 83
                              • 5.0.0

                              #89
                              Originally posted by quasar
                              I've updated a lot of details (removed the subdomain in case that was causing problems) and now everytime I click a link it goes direct to the 404.htm page.

                              I ran the SQL query listed in the help file and get the result that no files are recorded. It clearly isn't redirecting through the 404.php, and I'm now at a complete loss.

                              Any suggestions?
                              Any suggestions on this? A couple of weeks have gone by and I'm still no closer to solving the problem. I've checked everything over several times, but still the same result.

                              TIA

                              Comment

                              • quasar
                                Member
                                • Aug 2007
                                • 83
                                • 5.0.0

                                #90
                                Finally sorted the problem thanks to the help of a friend. Just a quick explanation of what was wrong in case anyone else has such a problem (my comments are (quasar) followed by my comment):

                                phpBB2 forum import from a root directory (phpBB2) to a folder (vB3):

                                PHP Code:
                                $old_folder     '';                                 // With trailing slash - (quasar) I left this blank as it was in root directory
                                $old_ext_type    '.php';                                     // Including preceding dot
                                $standard_404     'http://www.example.com/404.htm';     // The usual 404 that this script replaces (quasar) Full 404 URL, including http://

                                // Example :: www.example.com/vBulletin/

                                $new_domain     'www.example.com'// (quasar) without the http:// and no trailing slash ('/')
                                $new_folder        'forum/';    // With trailing slash (quasar) Note this is the folder without the first slash, but includes the trailing slash
                                $ext_type        '.php';         // File extension type that vBulletin is using, i.e. index.php including the preceding dot 
                                That's how I set up the 404.php file (along with database details).

                                Then, .htaccess should be like this:

                                PHP Code:
                                ErrorDocument 404 /forum/404.php 
                                Where by there is a preceding slash and a trailing one, but not the complete URL.

                                I found that it was a combination of both these that caused the problems.

                                Hope this helps someone in the future (Please note this doesn't supercede the readme file, but is meant to be a working example)

                                Quasar

                                Comment

                                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                                Working...