Redirect old URLs to vBulletin 5 URLs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ndoktoruser
    Member
    • Aug 2015
    • 69
    • 5.1.x

    Redirect old URLs to vBulletin 5 URLs

    Hello, everyone!

    I am migrating an existing forum (Phorum) to vBulletin 5.
    In one of the steps, I created a mapping of important URLs. When I say "important URLs", I mean forums and threads addresses. Other URLs are not important.

    Example:

    Forums

    /forum/forumname1-i101.html (old) => /forum/forumname1 (vB5)
    /forum/forumname2-i102.html (old) => /forum/forumname2 (vB5)

    Threads

    /forum/forumname1/thread1-101,1001.html (old) => /forum/forumname1/1001-thread1 (vB5)
    /forum/forumname1/thread2-101,1002.html (old) => /forum/forumname1/1002-thread2 (vB5)
    /forum/forumname2/thread3-102,1003.html (old) => /forum/forumname2/1003-thread3 (vB5)

    Is something in the vBulletin 5 architecture ideal for my case or should I use other solution.

    Important detail: I have about 200 thousand redirections (200 forums and 200,000 threads).
  • RoelVB
    Member
    • Dec 2013
    • 49
    • 5.0.X

    #2
    You could add those rewriterules to your .htaccess file:
    Code:
    RewriteRule ^forum/([A-Za-z0-9]+)\-([A-Za-z0-9]+).html$ forum/$1 [R=301,L]
    RewriteRule ^forum/([A-Za-z0-9]+)/([A-Za-z0-9]+)\-([0-9]+),([0-9]+).html$ forum/$1/$4-$2 [R=301,L]
    Those rules will redirect your users to the new URLs.

    You could test them over here: http://htaccess.mwl.be/

    Comment

    • Pragya soni
      New Member
      • Apr 2023
      • 6

      #3
      Hello everyone,

      I have upgraded Vbulletin version from 4.2.5 to 5.7.3. I observed that URL format does not match my existing forum which has Vbulletin version 4.2.5.
      My URL format for Forum into Vbulletin version 4.2.5

      Forum Id and Thread Id also do not match.

      Forum (Old URL) -> forums/18-Practice
      Threads (Old URL)-> threads/38765-Test-image-upplod

      After Upgrade version, site URL does not match format.

      Forum (New URL) -> forum/agriville-com-community-centre/practice
      Threads (New URL)-> forum/agriville-com-community-centre/practice/34703-test-image-upplod

      All forums are inside the category of agriville-com-community-centre.

      Can you please suggest to me, how to customise or rewrite rule for below URL?

      Forum -> forums/18-Practice
      Threads -> threads/38765-Test-image-upplod

      Comment

      • Trevor Hannant
        vBulletin Support
        • Aug 2002
        • 24358
        • 5.7.X

        #4
        In your .htaccess file, find the following section then un-comment the relevant lines to enable these redirect rules:

        Code:
            #If you used friendly urls in vB4, then uncommenting the following rules will redirect the #
            #old vB4 urls to a similar location in vB5.  This is unnecesary for a new vB5 install.
            #RewriteRule ^threads/.* showthread.php [QSA]
            #RewriteRule ^forums/.* forumdisplay.php [QSA]
            #RewriteRule ^members/.* member.php [QSA]
            #RewriteRule ^blogs/.* blog.php [QSA]
            #RewriteRule ^entries/.* entry.php [QSA]​
        Last edited by Wayne Luke; Tue 4 Apr '23, 8:10am.
        Vote for:

        - Admin Settable Paid Subscription Reminder Timeframe (vB6)
        - Add Admin ability to auto-subscribe users to specific channel(s) (vB6)

        Comment

        • Pragya soni
          New Member
          • Apr 2023
          • 6

          #5
          Hello Team,

          I have uncommented code of htaccess file which is suggested by you, but URL does not work for forum and thread. It redirects to home page.
          I also searched file forumdisplay.php and showthread.php into all folders, but these files does not exist.

          My older version of forums is Vbulletin 4.2.5 and I used Friendly URL setting for redirection

          Click image for larger version

Name:	dataurl445126.png
Views:	149
Size:	41.7 KB
ID:	4480119

          After upgrade version from Vbulletin 4.2.5 to 5.7.3, this feature not exist into current version. Due to this reason URL does not works as previous.
          I need to rewrite mode for my URL, so that I can get my URL as previous.

          Forum (Old URL) -> forums/18-Practice
          Threads (Old URL)-> threads/38765-Test-image-upplod
          After Upgrade version site URL does not match format.
          Forum (New URL) -> forum/agriville-com-community-centre/practice
          Threads (New URL)-> forum/agriville-com-community-centre/practice/34703-test-image-upplod

          All forums are inside the category of agriville-com-community-centre. We are trying to remove this from URL

          Can you please help me to get above URL format with same id?

          Comment

          • Wayne Luke
            vBulletin Technical Support Lead
            • Aug 2000
            • 74161

            #6
            You cannot use the previous URL format with the same ID. vBulletin 5 does not support it. You won't find the old school files of vBulletin 4.X either. They are obsolete and not used.

            The URL rewrites above should be the exact ones used in the .htaccess file provided with the vBulletin 4.2.5 download. The system will then feed the generated forumdisplay.php or showthread.php file to vBulletin 5's index.php file. The system will then match the ID number with the new ID provided when you upgraded to vBulletin 5. This will allow it to display the page.

            If you somehow customized your Mod Rewrite Friendly URLs using an third-party addon, you would have to use the same rewrites you used in vBulletin 4.2.5 within the .htaccess file provided by vBulletin 5. You cannot replace the .htaccess file that is provided with an older version.

            What are the exact contents of your vBulletin 4.2.5 .htaccess file?

            What are the current contents of the vBulletin 5.7.3 .htaccess file on your server?
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud demonstration site.
            vBulletin 5 API

            Comment

            • Pragya soni
              New Member
              • Apr 2023
              • 6

              #7
              Hello Team,

              Please find htaccess files for both the version 4.2.5 (htacess_version4-2-5.txt) and 5.7.3 (htaccess_version5.7.3.txt). Please check it and let me know.
              Attached Files

              Comment

              • Wayne Luke
                vBulletin Technical Support Lead
                • Aug 2000
                • 74161

                #8
                So in the supplied 5.7.3 .htaccess file, you have uncommented the RewriteBase line but not uncommented the lines below:

                Code:
                #RewriteRule ^threads/.* showthread.php [QSA]
                #RewriteRule ^forums/.* forumdisplay.php [QSA]
                The above two lines need to be uncommented by removing the # character.

                If vBulletin 5 will be in the root directory of your site using RewriteBase / is unnecessary. If it is in a sub-directory of your site it should be ReWriteBase /sub-directory


                Next in your 4.2.5 .htaccess, you have a number of hard coded redirects for topics and forums. You will most likely need to maintain these for them to work. If they aren't important then you can skip them.

                Finally, you have a custom redirect for topics:
                Code:
                #RewriteRule ^threads/.* showthread.php [QSA,L]
                RewriteRule ^(.*)$ showthread.php?$1 [L,QSA] #<-- This is custom
                You might need to maintain this. Ask your server administrator.

                Also for testing purposes, you should go into the AdminCP and set "Redirect 404s to Root Node" to no. Settings → Options → Site URLs and Routing.
                Translations provided by Google.

                Wayne Luke
                The Rabid Badger - a vBulletin Cloud demonstration site.
                vBulletin 5 API

                Comment

                • Pragya soni
                  New Member
                  • Apr 2023
                  • 6

                  #9
                  Hello Team,

                  I have added above code into htaccess file and getting error file not found.

                  AdminCP : Settings → Options → Site URLs and Routing.


                  Click image for larger version

Name:	image.png
Views:	130
Size:	98.6 KB
ID:	4480204

                  .htaccess file

                  Click image for larger version

Name:	image.png
Views:	116
Size:	109.8 KB
ID:	4480205

                  After doing all settings getting below error: File not Found

                  Click image for larger version

Name:	image.png
Views:	111
Size:	24.2 KB
ID:	4480206

                  Please let me know your thoughts on this.


                  ​​

                  Comment

                  • Wayne Luke
                    vBulletin Technical Support Lead
                    • Aug 2000
                    • 74161

                    #10
                    To be honest, I am not sure why it isn't working. The error you're showing now is not a vBulletin Error. If the redirects were not working in vBulletin, you would get a page with the site's header and footer and an error of "Invalid URL".

                    Please submit a Support Ticket.
                    Translations provided by Google.

                    Wayne Luke
                    The Rabid Badger - a vBulletin Cloud demonstration site.
                    vBulletin 5 API

                    Comment

                    Related Topics

                    Collapse

                    Working...