Join the community today
Register Now

Xenforo XenForo Redirects for vBulletin 1.0.2

Discussion in 'Forum software usage' started by Itworx4me, Feb 5, 2018.

  1. Itworx4me

    Itworx4me Active Member

    316
    29
    28
    Mar 14, 2017
    Ratings:
    +52
    Local Time:
    12:27 PM
    Nginx 1.27.4
    MariaDB 10.6.21
    Has anyone tested this on centmin yet?


    Thanks,
    Itworx4me
     
  2. Jon Snow

    Jon Snow Active Member

    842
    171
    43
    Jun 30, 2017
    Ratings:
    +258
    Local Time:
    4:27 PM
    Nginx 1.13.9
    MariaDB 10.1.31
    Was 1.0.2 a typo? o_O
     
  3. Itworx4me

    Itworx4me Active Member

    316
    29
    28
    Mar 14, 2017
    Ratings:
    +52
    Local Time:
    12:27 PM
    Nginx 1.27.4
    MariaDB 10.6.21
  4. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    8:27 PM
    Nginx 1.17.9
    MariaDB 10.3.22
  5. Jon Snow

    Jon Snow Active Member

    842
    171
    43
    Jun 30, 2017
    Ratings:
    +258
    Local Time:
    4:27 PM
    Nginx 1.13.9
    MariaDB 10.1.31
  6. Rake-GH

    Rake-GH Active Member

    179
    93
    28
    Jul 29, 2019
    USA
    Ratings:
    +144
    Local Time:
    3:27 PM
    default
    default
    Several people on the Xenforo forum are complaining that this addon doesn't work on nginx and haven't got a formal response from Xenforo, they said it's not supported by them.

    The addon in question is for Xenforo 2:
    XenForo Redirects for vBulletin

    The latest version is 1.1.5

    It redirects old vbulletin URLs to Xenforo, but it only works correctly on apache. Has anyone got this working?

    I tried a recommended fix which fixed 95% of redirects but introduced another bug where certain URLs are redirecting to "domain.com/domain.com/"

    Besides this, everything is working perfectly, and other people are complaining of the same issue, so I'm mostly sure that it's not my config. The Xenforo friendly URL rewrites are setup and working correctly per the instructions, so again, that should not be a cause of the issue.

    Here is the important portion of my conf:
    Code:
    location / {
    
        try_files $uri $uri/ /index.php?$uri&$args;
        index index.php index.html;
    
        #auth_basic "Private";
        #auth_basic_user_file /usr/local/nginx/conf/htpasswd;
    
        include /usr/local/nginx/conf/503include-only.conf;
    
        # block common exploits, sql injections etc
        include /usr/local/nginx/conf/block.conf;
    }
    
    location /admin.php {
       auth_basic "Private";
       auth_basic_user_file /usr/local/nginx/conf/htpasswd;
       include /usr/local/nginx/conf/php.conf;
    }
       
    location /install/ {
       auth_basic "Private";
       auth_basic_user_file /usr/local/nginx/conf/htpasswd;
       include /usr/local/nginx/conf/php.conf;
    }  
       
    location /install/data/ {
      internal;
    }
    location /install/templates/ {
      internal;
    }
    location /internal_data/ {
      internal;
    }
    location /library/ { #legacy
      internal;
    }
    location /src/ {
      internal;
    }
    
    location ~ \.php$ {
      #vbulletin redirect partial fix:
      #try_files $uri /index.php?$uri&$args;
     
      #normal:
      #try_files $uri =404;
     
      fastcgi_pass    127.0.0.1:9000;
      fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include         fastcgi_params;
    }
    My post on Xenforo forum is here, for more info:
    XenForo Redirects for vBulletin

    Any help would be appreciated.
     
  7. Rake-GH

    Rake-GH Active Member

    179
    93
    28
    Jul 29, 2019
    USA
    Ratings:
    +144
    Local Time:
    3:27 PM
    default
    default
    Fixed!

    you must have the Xenforo Redirects for vBulletin addon installed, and select your "import_log" table in the addon options.

    In the PHP block:

    you must comment out:
    Code:
    try_files $uri =404;
    replace it with:
    Code:
    try_files $uri /index.php?$uri&$args;
    Then restart nginx and clear your browser cache and maybe any other caches.

    Should that not solve your problem here is a fix for showthread.php, put this above you "location /" block


    Code:
    location ~ ^/showthread.php
    {
        if ($args ~* ^(\d+)-(.+)$)
        {
            set $tid $1;
            set $args '';
            rewrite ^ /threads/$tid permanent;
        }
    
       if ($args ~* ^t=(\d+)$)
        {
        set $tid $1;
        set $args '';
        rewrite ^ /threads/$tid permanent;
        }
    }
    
     
  8. Rake-GH

    Rake-GH Active Member

    179
    93
    28
    Jul 29, 2019
    USA
    Ratings:
    +144
    Local Time:
    3:27 PM
    default
    default
  9. Earl

    Earl New Member

    16
    6
    3
    Sep 17, 2015
    Ratings:
    +9
    Local Time:
    12:57 AM
    My problem is related to the exact same thing so I will post it here,
    Vbulletin forum was on site.com/forum/
    new xenforo is on site.com/
    I have created a directory named forum and moved the index.php and corrected the path as in the xenforo guide, but it's still not redirecting.

    but all urls are redirecting correctly without the /forum/ part.

    Can you guys help me with a little rewrite rule to remove this /forum/ part from the nginx $uri?

    I've tried this:

    Code:
     location ~ \.php$ {
      if ($uri ~ ^/forum/.*$) {
            rewrite ^/forum/(.*$) ^$1 permanent;
            }
          try_files $uri /index.php?$uri&$args;
          add_header X-uri2 "$uri";
          fastcgi_pass    127.0.0.1:9000;
          fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include         fastcgi_params;
      }
    and it gets stuck in a loop and stops the connection here
    Code:
    https://site.comt/forum/%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5Eshowthread.php?t=1449456
    there is something wrong with this part
    Code (Text):
    rewrite ^/forum/(.*$) ^$1 permanent;


    edit:
    location ~ ^/forum/.*$ {
    rewrite ^/forum/(.*$) /$1 permanent;
    }
    this did the trick
     
    Last edited: Apr 24, 2020