XenForo Redirects for vBulletin

XenForo Redirects for vBulletin 1.1.9

No permission to download
I've switched my forum from vB4 to XenForo 2, I've imported all the contents using the XenForo Importer and let it save all the logs in a table.

After I installed the plugin and activated but seems not to work.

My old link structure was this: https://www.mysite.it/forum/6-doman...10362-indice-e-confronta-e-risultati-multipli
(so it's /forum/ID-category-name/ID-topic-name)

The same topic now has this link strucutre: https://www.mysite.it/forum/threads/indice-e-confronta-e-risultati-multipli.10362/
(forum/threads/topic-name.ID)

Could someone give me some .htaccess rule before I lose all the indexing on Google? It's really urgent.
 
I recently upgraded from XF 1.5 to 2. For XF 1.5, I used this addon which worked great for URL redirection:
https://xenforo.com/community/resources/vbulletin-4-x-url-redirection.120/

But now that I'm on XF 2, many links are now broken since the addon isn't working anymore. For example, this URL:
http://www.domain.com/forum/showthread.php?44470-Beginner-s-Guide

Redirects to:
http://www.domain.com/forum/install/index.php?upgrade/

Which makes tons of links not redirect. I installed this XenForo Redirects for vBulletin addon, but the links still aren't redirecting, and old links are still redirecting to the upgrade page. How do you suggest I solve this? Thanks!

Here is my .htaccess:
Code:
Options +FollowSymLinks
RewriteEngine On
# post redirect
RewriteCond %{QUERY_STRING} (^|&|\?)p=([0-9]+)($|&)
RewriteRule ^showthread\.php$ /forum/posts/%2/? [R=301,L]
# thread redirect
RewriteCond %{QUERY_STRING} (^|\?)([0-9]+)$
RewriteRule ^showthread\.php$ /forum/threads/%2/? [R=301,L]
#RewriteBase /forum
#RewriteCond %{SERVER_PORT} 80
#RewriteRule ^(.*) https://www.domain.com/forum/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ https://www.domain.com/forum/$1 [R=permanent,L]
RewriteRule ^(.*)/(styleid=(.*))$ showthread.php?&%{QUERY_STRING} [L]
RewriteRule ^(.*)/(showthread\.php)$ showthread.php?&%{QUERY_STRING} [L]
RewriteRule ^(.*)/t-(.*)-(.*)-new.html showthread.php?t=$3&goto=newpost&%{QUERY_STRING} [L]
RewriteRule ^(.*)/t-(.*)-(.*)-last.html showthread.php?t=$3&goto=lastpost&%{QUERY_STRING} [L]
RewriteRule ^(.*)/t-(.*)-(.*)-print.html/(.*)$ printthread.php?t=$3&%{QUERY_STRING}&is_vrewrite=yes [L]
RewriteRule ^(.*)/t-(.*)-(.*)-print.html printthread.php?t=$3&is_vrewrite=yes&%{QUERY_STRING} [L]
RewriteRule ^(.*)/t-(.*)-(.*)-nextnewest.html showthread.php?t=$3&goto=nextnewest&is_vrewrite=yes&%{QUERY_STRING} [L]
RewriteRule ^(.*)/t-(.*)-(.*)-nextoldest.html showthread.php?t=$3&goto=nextoldest&is_vrewrite=yes&%{QUERY_STRING} [L]
RewriteRule ^p-(.*)-post(.*)/postcount(.*).html showpost.php?p=$2&postcount=$3&is_vrewrite=yes&%{QUERY_STRING} [L]
RewriteRule ^(.*)/t-(.*)-(.*)-page(.*).html showthread.php?t=$3&page=$4&is_vrewrite=yes&%{QUERY_STRING} [L]
RewriteRule ^(.*)/t-(.*)-(.*)/page(.*).html showthread.php?t=$3&page=$4&is_vrewrite=yes&%{QUERY_STRING} [L]
RewriteRule ^(.*)/t-(.*)-(.*).html/(.*)$ showthread.php?t=$3&%{QUERY_STRING}&is_vrewrite=yes [L]
RewriteRule ^(.*)/t-(.*)-(.*).html showthread.php?t=$3&is_vrewrite=yes&%{QUERY_STRING} [L]
RewriteRule ^f-(.*)-(.*)/misc\.php$ misc.php?&%{QUERY_STRING}&is_vrewrite=yes&%{QUERY_STRING} [L]
RewriteRule ^members/(.*)-(.*).html member.php?u=$2&is_vrewrite=yes&%{QUERY_STRING} [L]
RewriteRule ^u-(.*)-(.*).html(.*) member.php?u=$2&is_vrewrite=yes&%{QUERY_STRING}$3 [L]
RewriteRule ^u-(.*)-(.*).html member.php?u=$2&is_vrewrite=yes&%{QUERY_STRING} [L]
RewriteRule ^f-(.*)-(.*)/page(.*).html/(.*)$ forumdisplay.php?f=$2&&page=$3%{QUERY_STRING}&is_vrewrite=yes [L]
RewriteRule ^f-(.*)-(.*)/(.*)$ forumdisplay.php?f=$2&&%{QUERY_STRING}&is_vrewrite=yes [L]
RewriteRule ^f-(.*)-(.*)/$ forumdisplay.php?f=$2&%{QUERY_STRING}&is_vrewrite=yes [L]
RewriteRule ^search-(.*).html$ search.php?do=$1 [L]

#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /forum

    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>

# Wordfence WAF
<IfModule mod_php5.c>
    php_value auto_prepend_file none
</IfModule>
<Files ".user.ini">
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
    Order deny,allow
    Deny from all
</IfModule>
</Files>

# END Wordfence WAF
 
Does this conflict with the old vB 4 URL Redirect addon from XF 4? Tons of links aren't working now and need to get these resolved ASAP. Will pay to get the above issue solved ASAP. Thanks.

Just noticed in my forum root I had a showthread.php file, not sure why it was there, but renamed it. Now during the redirect I get:
MySQL statement prepare error [1146]: Table 'name_xdb.import_table_name' doesn't exist
What's the best way to solve this?
Thanks,
 
Last edited:
I ended up opening a ticket and Xenforo support helped solve it. Here was the suggestion for others in the same spot:
The easiest fix would be to upload these new redirect scripts for XF2, replacing the old files (e.g. showthread.php):

https://xenforo.com/community/resources/redirection-scripts-for-vbulletin-3-x.5949/

Simply replacing the old files with the new ones (while keeping the same 301config.php settings) should get redirects working again under XF2.

The other option is to use that new addon you linked:

https://xenforo.com/community/resources/xenforo-redirects-for-vbulletin.6123/

This add-on should also work out-of-the-box assuming:

1) You specify the import_log table in the options.

2) vB was in the same directory as XF.
 
The instructions at http://xenforo.com/help/import-redirection/ contain the following:

Open the 301config.php file for the import scripts and find the line that references the import log table, and edit it according to the instructions given in that file to point to your archived import log table:

define('IMPORT_LOG_TABLE', 'import_log_old_forum');>

  1. In the latest version (1.1.2), where is that 301config.php file located? I can't find it.
  2. How exactly do you run this? I don't see in in Tools.
 
@Kier @Chris D @Mike

Please help.

Does this add-on redirect TAG result pages & Link Forums from vBulletin to XenForo 2.0 ?

I used below redirection scripts.
https://xenforo.com/community/resources/redirection-scripts-for-vbulletin-3-x.5949/

They are very useful to redirect vBulletin threads, posts, members to corresponding XenForo 2.0 threads, posts, members.

However, not redirecting the "Link Forums" & "Tags".

The code to redirect Link Forums and Tags was done by Kier in XF 1.5 redirection scripts.
Not sure why its removed in XF 2.0 redirection scripts.
 
It looks like tags and link forums should work, but you'll need to provide some example VB URLs so we can test.
 
Same here.
I migrated from vB4 to XF1
After I upgraded xf1 to xf2, I also have to upgrade redirection scripts (this one) from older one.
Yesterday, when xf 2.0.2 come with addon XenForo Redirects for vBulletin I remove redirect scripts and install official addon but any old vb link on my forum just show 404 Not Found.

nginx 1.13.8
php 7.2.2

I uninstall this addon and put redirect scripts back to server and everything is fine.
How to redirect old vb links without redirect sript to xf links with help of this addon?
@Kier I do not have any vbulletin folder. My forum is in root, so when migrated, I delete vbulletin files and upload xf files.
I migrated from vb4 to xf1 some 3 years ago.
Only thing that I did is upload this redirect scripts and all old vblinks redirect to xenforo. That all working. vB links redirect to xenforo links.
Only thing I change is edit 301config.php file to point to import log table.

When this adon show up, I delete all that files (redirect scripts) including 301config files, install this addon, in options of addon point to import log table but old links (vb links) shows 404 not found.

nginx 1.13.8
php 7.2.2

Code:
# cat /usr/local/nginx/conf/conf.d/pijanitvor.com.ssl.conf

# Centmin Mod Getting Started Guide
# must read http://centminmod.com/getstarted.html
# For SPDY SSL Setup
# read http://centminmod.com/nginx_configure_https_ssl_spdy.html

# redirect from www to non-www  forced SSL
# uncomment, save file and restart Nginx to enable
# if unsure use return 302 before using return 301
server {
   server_name pijanitvor.com www.pijanitvor.com;
    return 301 https://www.$server_name$request_uri;
}

server {
  listen 443 ssl http2;
  server_name pijanitvor.com www.pijanitvor.com;

  ##  redirect https non-www to https www
      if ($host = 'pijanitvor.com' ) {
         return 301 https://www.pijanitvor.com$request_uri;
      }

  ssl_dhparam /usr/local/nginx/conf/ssl/pijanitvor.com/dhparam.pem;
  ssl_certificate      /usr/local/nginx/conf/ssl/pijanitvor.com/ssl-unified.crt;
  ssl_certificate_key  /usr/local/nginx/conf/ssl/pijanitvor.com/pijanitvor.com.key;
  include /usr/local/nginx/conf/ssl_include.conf;

  # mozilla recommended
  ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
  ssl_prefer_server_ciphers   on;
  #######################add_header Alternate-Protocol  443:npn-spdy/3;
  #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
  #add_header  X-Content-Type-Options "nosniff";
  #add_header X-Frame-Options DENY;
  #######################spdy_headers_comp 5;
  ssl_buffer_size 1400;
  ssl_session_tickets on;

  #enable ocsp stapling
  resolver 8.8.8.8 8.8.4.4 valid=10m;
  resolver_timeout 10s;
  ssl_stapling on;
  ssl_stapling_verify on;
  ssl_trusted_certificate /usr/local/nginx/conf/ssl/pijanitvor.com/ssl-trusted.crt;

# ngx_pagespeed & ngx_pagespeed handler
#include /usr/local/nginx/conf/pagespeed.conf;
#include /usr/local/nginx/conf/pagespeedhandler.conf;
#include /usr/local/nginx/conf/pagespeedstatslog.conf;

  # limit_conn limit_per_ip 16;
  # ssi  on;

  access_log /home/nginx/domains/pijanitvor.com/log/access.log combined buffer=256k flush=60m;
  error_log /home/nginx/domains/pijanitvor.com/log/error.log;

  root /home/nginx/domains/pijanitvor.com/public;

  location / {
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php?$uri&$args;
        include /usr/local/nginx/conf/blockbots.conf;
    }

### ORIGINAL ###
location /internal_data/ {
        internal;
        allow 127.0.0.1;
        allow xxxxxxxxx;
        deny all;
    }

    location /library/ {
        internal;
        allow 127.0.0.1;
        allow xxxxxxxx;
        deny all;
    }

  # prevent access to ./directories and files
        location ~ (?:^|/)\. {
   deny all;
        }


  include /usr/local/nginx/conf/staticfiles.conf;
  include /usr/local/nginx/conf/php.conf;
  include /usr/local/nginx/conf/drop.conf;
  #include /usr/local/nginx/conf/errorpage.conf;
  include /usr/local/nginx/conf/vts_server.conf;
}


Tried this new version but still not working.
Same error like with previous version.
Old redirect addon works (showthread.php etc...), but removing it and installing this new addon not works.
Friendly urls are enabled.
Forum is in root like was vb forum too

Code:
# cat /usr/local/nginx/conf/conf.d/pijanitvor.com.ssl.conf


# Centmin Mod Getting Started Guide
# must read http://centminmod.com/getstarted.html
# For SPDY SSL Setup
# read http://centminmod.com/nginx_configure_https_ssl_spdy.html

# redirect from www to non-www  forced SSL
# uncomment, save file and restart Nginx to enable
# if unsure use return 302 before using return 301
 server {
   server_name pijanitvor.com www.pijanitvor.com;
    return 301 https://www.$server_name$request_uri;
 }

server {
  listen 443 ssl http2;
  server_name pijanitvor.com www.pijanitvor.com;

  ##  redirect https non-www to https www
      if ($host = 'pijanitvor.com' ) {
         return 301 https://www.pijanitvor.com$request_uri;
      }
 
  ssl_dhparam /usr/local/nginx/conf/ssl/pijanitvor.com/dhparam.pem;
  ssl_certificate      /usr/local/nginx/conf/ssl/pijanitvor.com/ssl-unified.crt;
  ssl_certificate_key  /usr/local/nginx/conf/ssl/pijanitvor.com/pijanitvor.com.key;
  include /usr/local/nginx/conf/ssl_include.conf;

  # mozilla recommended
  ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
  ssl_prefer_server_ciphers   on;
  #######################add_header Alternate-Protocol  443:npn-spdy/3;
  #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
  #add_header  X-Content-Type-Options "nosniff";
  #add_header X-Frame-Options DENY;
  #######################spdy_headers_comp 5;
  ssl_buffer_size 1400;
  ssl_session_tickets on;
 
  #enable ocsp stapling
  resolver 8.8.8.8 8.8.4.4 valid=10m;
  resolver_timeout 10s;
  ssl_stapling on;
  ssl_stapling_verify on;
  ssl_trusted_certificate /usr/local/nginx/conf/ssl/pijanitvor.com/ssl-trusted.crt; 

# ngx_pagespeed & ngx_pagespeed handler
#include /usr/local/nginx/conf/pagespeed.conf;
#include /usr/local/nginx/conf/pagespeedhandler.conf;
#include /usr/local/nginx/conf/pagespeedstatslog.conf;

  # limit_conn limit_per_ip 16;
  # ssi  on;

  access_log /home/nginx/domains/pijanitvor.com/log/access.log combined buffer=256k flush=60m;
  error_log /home/nginx/domains/pijanitvor.com/log/error.log;

  root /home/nginx/domains/pijanitvor.com/public;

  location / {
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php?$uri&$args;
       include /usr/local/nginx/conf/blockbots.conf;
    }

location /internal_data/ {
        internal;
        allow 127.0.0.1;
        allow xxxxxxxxxx;
        deny all;
    }
    
    location /library/ {
        internal;
        allow 127.0.0.1;
        allow xxxxxxxxxx;
        deny all;
    }
 
    location /install/data/ {
        internal;
        allow 127.0.0.1;
        allow xxxxxxxxxx;
        deny all;
    }
 
      location /install/templates/ {
        internal;
        allow 127.0.0.1;
        allow xxxxxxxxxx;
        deny all;
    }
 
      location /src/ {
        internal;
        allow 127.0.0.1;
        allow xxxxxxxxxx;
        deny all;
    }

  # prevent access to ./directories and files
        location ~ (?:^|/)\. {
   deny all;
        } 


  include /usr/local/nginx/conf/staticfiles.conf;
  include /usr/local/nginx/conf/php.conf;
  include /usr/local/nginx/conf/drop.conf;
  #include /usr/local/nginx/conf/errorpage.conf;
  include /usr/local/nginx/conf/vts_server.conf;
}


Server specification:

screenshot-www.pijanitvor.com-2018.09.18-23-27-53.webp
 
Something like below (vB tag page to XF 2.0 tag page) :

http://www.test.com/forum/tags.php?tag=chicago
to
http://www.test.com/tags/chicago/

I have sent a PM with exact links. Kindly check.
The first thing I recommend is upgrading the XF301VB add-on. I think you're currently running 1.1.1 but we released version 1.1.2 last week. That should solve the link-forums issue.

For the tags.php issue, can you please check the file on the server itself? Does it look like it contains reference to XenForo code? If so, then that might be the problem, it looks like that file could actually be one of the old XF1 redirection scripts.
 
The first thing I recommend is upgrading the XF301VB add-on. I think you're currently running 1.1.1 but we released version 1.1.2 last week. That should solve the link-forums issue.
I have put a support ticket yesterday and I was replied its better to use redirection scripts (for my case) than the Add-On.
I NEVER used the above mentioned add-on.

I downloaded Redirection scripts for XF 2.0 just 1 hour back from below link and uploaded to my server :
https://xenforo.com/community/resources/redirection-scripts-for-vbulletin-3-x.5949/


For the tags.php issue, can you please check the file on the server itself? Does it look like it contains reference to XenForo code? If so, then that might be the problem, it looks like that file could actually be one of the old XF1 redirection scripts.

You are right. XF 1.0 redirection scripts had a tags.php file and I was using that.
But in XF 2.0 redirection scripts, the tags.php file is totally missing.
 
@Chris D
If you think above add-on will solve my problem, I can try the same.
But for that, do we need to first remove existing redirection script files we uploaded to server ?
(or) The add-on will work despite of that ?
 
I NEVER used the above mentioned add-on.
Well, this is the support thread for that add-on :) So I've been looking at the wrong thing all of this time.

You can try this add-on. I think you would have to remove the old redirection script files, but there is a chance it may still not work judging by @Sunka's comments.

If tags.php is missing from those others, I'll just see if we can add that.
 
Well, this is the support thread for that add-on :) So I've been looking at the wrong thing all of this time.

You can try this add-on. I think you would have to remove the old redirection script files, but there is a chance it may still not work judging by @Sunka's comments.

If tags.php is missing from those others, I'll just see if we can add that.
Will try the add-on and let you know.

About tags.php, I actually told KIER last year that Tags redirection is missing, and so he added the file in XF 1.0 redirects.
Everything was perfectly working until I upgraded to XF 2.0 and now tags.php is missing there.
It will be very useful if you can get it added.
 
This is a version of the old redirection scripts but with tags.php and link forums/category link support.

I haven't tested it, so if anyone can and test it works then that'd be great.
 

Attachments

This is a version of the old redirection scripts but with tags.php and link forums/category link support.

I haven't tested it, so if anyone can and test it works then that'd be great.
I will test and let you know.

What files did you change ?
Just added tags.php (or) modified code in any other files also ?
 
This is a version of the old redirection scripts but with tags.php and link forums/category link support.

I haven't tested it, so if anyone can and test it works then that'd be great.
Just tested the tags.php.

It gives below error.

Fatal error: Using $this when not in object context in /home/test/public_html/forum/tags.php on line 26
 
Top Bottom