XenForo Redirects for vBulletin

XenForo Redirects for vBulletin 1.1.1

No permission to download

Mr Lucky

Well-known member
#22
OK, this is working very well now, EXCEPT one odd thing.

I have configured for previous vbulletin installation in a subdirectory. (It is now in root but was in /community/)

So have copied (from SourceLocation) .htaccess and index.php copied into /community/ as in the instructions, and the redirects are just showing a blank white page.

index.php =

PHP:
<?php

// Enter the full path to your XenForo directory here:
$dir = '/home/username/public_html/xenforo2';

require($dir . '/home/caf/public_html');

XF::start($dir);
XF::runApp('XF301VB\Pub\App');
BUT

it all works perfectly if instead of that I just keep what I previously, which was a catch-all redirect from the subdirectory /community/

ie in there I already had .htaccess (which I disabled while testing the xenforo method). This is what I had in there:

Code:
RewriteEngine On

RewriteRule ^(.*)$ /$1 [R=301,L]
So as it all works like this, shall I keep it like that or better to try and get it working as in the xenforo instructions?

 

Kier

XenForo Developer
Staff member
#23
OK, this is working very well now, EXCEPT one odd thing.

I have configured for previous vbulletin installation in a subdirectory. (It is now in root but was in /community/)

So have copied (from SourceLocation) .htaccess and index.php copied into /community/ as in the instructions, and the redirects are just showing a blank white page.

index.php =

PHP:
<?php

// Enter the full path to your XenForo directory here:
$dir = '/home/username/public_html/xenforo2';

require($dir . '/home/caf/public_html');

XF::start($dir);
XF::runApp('XF301VB\Pub\App');
BUT

it all works perfectly if instead of that I just keep what I previously, which was a catch-all redirect from the subdirectory /community/

ie in there I already had .htaccess (which I disabled while testing the xenforo method). This is what I had in there:

Code:
RewriteEngine On

RewriteRule ^(.*)$ /$1 [R=301,L]
So as it all works like this, shall I keep it like that or better to try and get it working as in the xenforo instructions?

is that the actual content of your index.php? You should have edited the $dir value, rather than editing the require() line - give that a try and you should have more luck.
 

Kier

XenForo Developer
Staff member
#24
@Mr Lucky just to be clear, your index.php should look like this:
PHP:
<?php

// Enter the full path to your XenForo directory here:
$dir = '/home/caf/public_html';

require($dir . '/src/XF.php');

XF::start($dir);
XF::runApp('XF301VB\Pub\App');
and your old .htaccess file should be removed in favour of the one that ships with XF301VB.
 

Sunka

Well-known member
#27
Sadly not working for us :/

Old VB4 URL: https://forum.blabla.cz/showthread.php/120013-something
New XF2 URL: https://forum.blabla.cz/threads/something.120013/

By calling the old URL we're getting:


Note that we've migrated from vB to XF1 then to XF2 BETA1. Now we're on XF2 2.0.1

Thank you in advance for your help.

Alex
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?
 

Mr Lucky

Well-known member
#28
I am getting this e
@Mr Lucky just to be clear, your index.php should look like this:
PHP:
<?php

// Enter the full path to your XenForo directory here:
$dir = '/home/caf/public_html';

require($dir . '/src/XF.php');

XF::start($dir);
XF::runApp('XF301VB\Pub\App');
and your old .htaccess file should be removed in favour of the one that ships with XF301VB.
index.php configured as it should be now. my old old .htaccess replaced with xenforo .htaccess (in /community/ directory)

I am getting this error:

Code:
    ErrorException: [E_WARNING] Cannot modify header information - headers already sent by (output started at /home/caf/public_html/community/index.php:1) src/XF/Http/Response.php:345

    Generated by: Unknown account Feb 3, 2018 at 11:38 AM

Stack trace

#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] Can...', '/home/caf/publi...', 345, Array)
#1 src/XF/Http/Response.php(345): header('X-Frame-Options...', false)
#2 src/XF/Http/Response.php(262): XF\Http\Response->sendHeaders()
#3 src/XF.php(355): XF\Http\Response->send(Object(XF\Http\Request))
#4 community/index.php(10): XF::runApp('XF301VB\\Pub\\App')
#5 {main}

Request state

array(4) {
  ["url"] => string(45) "/community/showthread.php?10559-Various-books"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["10559-Various-books"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
NB: previous (working) xf1 301config.php:

Code:
<?php

/* ----------------------------------------------------------- *\
This variable defines where XenForo is installed.

If you have not installed XenForo into the same directory in which
vBulletin was installed, you will need to provide the full path to
the XenForo directory here. Remove the leading // and then enter
the path as in the following examples:

    $fileDir = '/home/example/public_html/new_forums';

    $fileDir = 'C:/inetpub/wwwroot/xenforo';

\* ----------------------------------------------------------- */

    $fileDir = '/home/caf/public_html';

/* ----------------------------------------------------------- *\
This constant defines the table from which the import redirection
scripts will fetch their data. Normally they will use the table
'xf_import_log', but if you have archived your import data, you
should provide the name of the archive table here. Remove the
leading // and then replace 'import_log_x' with the name of your
archive table, as in the following examples:

    define('IMPORT_LOG_TABLE', 'my_import_log');

    define('IMPORT_LOG_TABLE', 'import_log_my_forums');

\* ----------------------------------------------------------- */

    define('IMPORT_LOG_TABLE', 'archived_import_log');
 
Last edited:

Kier

XenForo Developer
Staff member
#29
@Mr Lucky your error 'ErrorException: [E_WARNING] Cannot modify header information - headers already sent' suggests that there are errors in your index.php that cause content to be output, such as whitespace before the <?php tag. Try killing it and editing a fresh copy from the SourceLocation folder.

If you are still having problems after that, submit a support ticket for my attention including SSH details for your server.
 

Mr Lucky

Well-known member
#30
@Mr Lucky your error 'ErrorException: [E_WARNING] Cannot modify header information - headers already sent' suggests that there are errors in your index.php that cause content to be output, such as whitespace before the <?php tag. Try killing it and editing a fresh copy from the SourceLocation folder.

If you are still having problems after that, submit a support ticket for my attention including SSH details for your server.
Yes, there was witespace (I'd copied and pasted from your code in post 24 above and must have done that by mistake , however still doesn't work with fresh index.php. It converts the URL but does not redirect out of the /community/ directory

Will submit the ticket for you.
 

Sunka

Well-known member
#31
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?
Any help with this?
 

Sunka

Well-known member
#33
@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;
}
 

Ouard

New member
#34
This add-ons works fine but causes a bug when you want to copy a post to another discussion.
Code:
TypeError: Argument 2 passed to XF301VB\Mvc\Router::getVbulletin4RewriteMatch()
must be an instance of XF\Http\Request, null given,
called in /home.../src/addons/XF301VB/Mvc/Router.php on line 72
src/addons/XF301VB/Mvc/Router.php:152
 

Mr Lucky

Well-known member
#35
This add-ons works fine but causes a bug when you want to copy a post to another discussion.
Code:
TypeError: Argument 2 passed to XF301VB\Mvc\Router::getVbulletin4RewriteMatch()
must be an instance of XF\Http\Request, null given,
called in /home.../src/addons/XF301VB/Mvc/Router.php on line 72
src/addons/XF301VB/Mvc/Router.php:152
Same thing here. When I disable the addon I can move a post from one thread to another. If the addon is enabled, I get this:

Code:
    ypeError: Argument 2 passed to XF301VB\Mvc\Router::getVbulletin4RewriteMatch() must be an instance of XF\Http\Request, null given, called in /home/caf/public_html/src/addons/XF301VB/Mvc/Router.php on line 72 src/addons/XF301VB/Mvc/Router.php:152

    Generated by: Pete Thomas Feb 28, 2018 at 10:17 AM

Stack trace

#0 src/addons/XF301VB/Mvc/Router.php(72): XF301VB\Mvc\Router->getVbulletin4RewriteMatch('threads', NULL)
#1 src/XF/Repository/Thread.php(328): XF301VB\Mvc\Router->routeToController('threads/drum-be...')
#2 src/XF/InlineMod/Post/AbstractMoveCopy.php(34): XF\Repository\Thread->getThreadFromUrl('https://cafesax...', NULL, NULL)
#3 src/XF/InlineMod/AbstractAction.php(57): XF\InlineMod\Post\AbstractMoveCopy->canApplyInternal(Object(XF\Mvc\Entity\ArrayCollection), Array, NULL)
#4 src/XF/Pub/Controller/InlineMod.php(111): XF\InlineMod\AbstractAction->canApply(Object(XF\Mvc\Entity\ArrayCollection), Array, NULL)
#5 src/XF/Mvc/Dispatcher.php(249): XF\Pub\Controller\InlineMod->actionPerform(Object(XF\Mvc\ParameterBag))
#6 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:InlineMod', 'Perform', 'json', Object(XF\Mvc\ParameterBag), '', Object(XF\Pub\Controller\InlineMod), Object(XF\Mvc\Reply\Reroute))
#7 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(1889): XF\Mvc\Dispatcher->run()
#9 src/XF.php(328): XF\App->run()
#10 index.php(13): XF::runApp('XF\\Pub\\App')
#11 {main}

Request state

array(4) {
  ["url"] => string(12) "/inline-mod/"
  ["referrer"] => string(51) "https://cafesaxophone.com/threads/drum-beats.24081/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(11) {
    ["thread_type"] => string(8) "existing"
    ["existing_url"] => string(51) "https://cafesaxophone.com/threads/drum-beats.23986/"
    ["ids"] => array(1) {
      [0] => string(6) "355777"
    }
    ["type"] => string(4) "post"
    ["action"] => string(4) "move"
    ["confirmed"] => string(1) "1"
    ["_xfRedirect"] => string(51) "https://cafesaxophone.com/threads/drum-beats.24081/"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(26) "/threads/drum-beats.24081/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

Delete
 
#36
When adding a thread poll widget via admin.php?widgets/add I get an error.

The thread URL I'm submitting looks like this:
https://xxx.com/threads/thread-name.9988/

It appears to be parsing the poll thread url through this redirect script.

Code:
TypeError: Argument 2 passed to XF301VB\Mvc\Router::getVbulletin4RewriteMatch() must be an instance of XF\Http\Request, null given, called in /home/guidedh9/public_html/src/addons/XF301VB/Mvc/Router.php on line 72 src/addons/XF301VB/Mvc/Router.php:152
Generated by: Rake Mar 8, 2018 at 9:11 PM
Stack trace
#0 src/addons/XF301VB/Mvc/Router.php(72): XF301VB\Mvc\Router->getVbulletin4RewriteMatch('threads', NULL)
#1 src/XF/Repository/Thread.php(328): XF301VB\Mvc\Router->routeToController('threads/whos-th...')
#2 src/XF/Widget/ThreadPoll.php(9): XF\Repository\Thread->getThreadFromUrl('threads/whos-th...', 'public', NULL)
#3 src/XF/Widget/AbstractPollWidget.php(53): XF\Widget\ThreadPoll->getPollFromRoutePath('threads/whos-th...', NULL)
#4 src/XF/Admin/Controller/Widget.php(115): XF\Widget\AbstractPollWidget->verifyOptions(Object(XF\Http\Request), Array, NULL)
#5 src/XF/Mvc/FormAction.php(140): XF\Admin\Controller\Widget->XF\Admin\Controller\{closure}(Object(XF\Mvc\FormAction))
#6 src/XF/Admin/Controller/Widget.php(148): XF\Mvc\FormAction->run()
#7 src/XF/Mvc/Dispatcher.php(249): XF\Admin\Controller\Widget->actionSave(Object(XF\Mvc\ParameterBag))
#8 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Widget', 'Save', 'json', Object(XF\Mvc\ParameterBag), 'widgets', Object(XF\Admin\Controller\Widget), NULL)
#9 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(1889): XF\Mvc\Dispatcher->run()
#11 src/XF.php(328): XF\App->run()
#12 admin.php(13): XF::runApp('XF\\Admin\\App')
#13 {main}
Request state
array(4) {
  ["url"] => string(37) "/admin.php?widgets/thread-poll.0/save"
  ["referrer"] => string(73) "https://***.com/admin.php?widgets/add&definition_id=thread_poll"
  ["_GET"] => array(1) {
    ["widgets/thread-poll_0/save"] => string(0) ""
  }
  ["_POST"] => array(9) {
    ["definition_id"] => string(11) "thread_poll"
    ["widget_key"] => string(11) "thread_poll"
    ["title"] => string(12) "Current Poll"
    ["positions"] => array(1) {
      ["forum_list_sidebar"] => string(3) "999"
    }
    ["options"] => array(1) {
      ["content_url"] => string(76) "https://***.com/threads/thread-name.9988/"
    }
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(48) "/admin.php?widgets/add&definition_id=thread_poll"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
Anyone else have this issue or know a solution?
 
Last edited:

XenForo

Company Info
Staff member
#37
XenForo updated XenForo Redirects for vBulletin with a new update entry:

1.1.0, with support for non-content paths

Following suggestions from @Steffen, the redirect add-on will now support a collection of non-content links that may be commonly referrered to in user generated content.
I'd consider some of them essential because they are likely referenced in old threads and emails (lostpw, terms, requestemail), others would be nice to have.
Code:
/login.php -> /login/
/login.php?do=lostpw -> /lost-password/
/memberlist.php -> /members/...
Read the rest of this update entry...
 
Top