XenForo Redirects for vBulletin

XenForo Redirects for vBulletin 1.1.9

No permission to download
Getting server errors after upgrading to XF2.2.2:

  • Error: Macro public:quick_reply_macros :: body() error: Call to a member function getProperty() on null
  • src/XF/Template/Templater.php:2313
  • Generated by: Unknown account
  • Dec 31, 2020 at 10:55 AM

Stack trace​


#0 src/XF/Template/Templater.php(2206): XF\Template\Templater->getFallbackAvatarHtml('avatar-u0-m', Array)
#1 src/XF/Template/Templater.php(2153): XF\Template\Templater->getDynamicAvatarHtml('', 'avatar-u0-m', Array)
#2 src/addons/SV/UserActivity/XF/Template/Templater.php(36): XF\Template\Templater->fnAvatar(Object(SV\StandardLib\XF\Template\Templater), false, NULL, 'm', false, Array)
#3 [internal function]: SV\UserActivity\XF\Template\Templater->fnAvatar(Object(SV\StandardLib\XF\Template\Templater), false, NULL, 'm', false, Array)
#4 src/XF/Template/Templater.php(1103): call_user_func_array(Array, Array)
#5 internal_data/code_cache/templates/l1/s0/public/quick_reply_macros.php(45): XF\Template\Templater->func('avatar', Array)
#6 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
#7 internal_data/code_cache/templates/l1/s0/public/thread_view.php(1001): XF\Template\Templater->callMacro('quick_reply_mac...', 'body', Array, Array)
#8 src/XF/Template/Templater.php(1626): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#9 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('thread_view', Array)
#10 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#11 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Thread\\View', 'public:thread_v...', Array)
#12 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#13 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#14 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#15 src/XF/App.php(2300): XF\Mvc\Dispatcher->run()
#16 src/XF.php(488): XF\App->run()
#17 /home/xxx/public_html/forum/vbulletin/index.php(9): XF::runApp('XF301VB\\Pub\\App')
#18 {main}


Request state​

array(4) {
["url"] => string(75) "/vbulletin/threads/xxx/page-5"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
Getting server errors after upgrading to XF2.2.2
What did you upgrade FROM?

Looks to me like you have an old addon or two which needs to be upgraded. Several errors reference "SV\StandardLib" which is @Xon's Standard Library for all of his addons. I know that has had several recent updates and the current versions are fully compatible with Xenforo 2.2.

Start by going through your list of installed addons and checking for updates. The easiest way to do this is to find the addon and make sure that you have clicked on Watch and that you have selected email notification for the addon. That will you will get notified for eack update.
 
What did you upgrade FROM?

Looks to me like you have an old addon or two which needs to be upgraded. Several errors reference "SV\StandardLib" which is @Xon's Standard Library for all of his addons. I know that has had several recent updates and the current versions are fully compatible with Xenforo 2.2.

Start by going through your list of installed addons and checking for updates. The easiest way to do this is to find the addon and make sure that you have clicked on Watch and that you have selected email notification for the addon. That will you will get notified for eack update.

Upgrade was from 2.1.12.

I just ran down my addon list and everything is at the current version, including all of Xon's addons.
 
Upgrade was from 2.1.12.

I just ran down my addon list and everything is at the current version, including all of Xon's addons.
That's weird. I am running the vB redirection addon on at least 3 forums I manage that also include one or more @Xon addons and numerous others and I'm not seeing this error at all. I'm not an expert in reading these server error details though...

I would follow the usual recommendations:
  1. see of the error occurs in the Xenforo default style
  2. make sure you have merged/reverted all outdated templates
  3. make sure all of your current addons have been explicitly updated for 2.2.x (many still have not been - uninstall those)
  4. if the error still persists, disable all addons and see whether the error disappears - if it does, then re-enable addons one by one until the error re-appears and then you'll know what's causing the problem
 
PHP:
protected function getFallbackAvatarHtml($innerClassHtml, array &$outerAttributes)
{
...
   $fallbackType = $this->style->getProperty('avatarDefaultType', 'text');
The error line is because $this->style in XF\Template\Templater is null. None of my code touches how this is setup.
 
PHP:
protected function getFallbackAvatarHtml($innerClassHtml, array &$outerAttributes)
{
...
   $fallbackType = $this->style->getProperty('avatarDefaultType', 'text');
The error line is because $this->style in XF\Template\Templater is null. None of my code touches how this is setup.

Thanks for checking, @Xon.

Hrm. I have two styles, the XF default is set as default. I tried moving the default over to the other style temporarily and still the same error.

I have tried disabling all addons and still continue to get the errors. All templates are up-to-date.
 
Any more thoughts on this? I'm getting hundreds of errors per day and my redirects are currently all broken. What is the correct method of getting support for this plugin, as it seems like a semi-official one?
 
["url"] => string(75) "/vbulletin/threads/xxx/page-5"
This appears to be a XF URL accessed within your vBulletin directory. There may need to be a change in this add-on to prevent an explicit error, but this wasn't really a valid/expected URL. It'd probably end up being a broken page anyway.

I don't know what your vB URLs looked like (I'm assuming they were showthread.php and so on), but it might be worth using .htaccess rules in your vbulletin/ directory to redirect XF URLs back to the parent/correct location. That would avoid the error (and make them work as would normally be expected even if that error didn't happen).

Untested, but something like this might work (in the vbulletin/ directory):

Code:
RewriteEngine On
RewriteRule ^(threads)/(.*)$ https://example.com/$1/$2 [R=301,L]

This shouldn't affect actual legitimate, redirectable URLs as they shouldn't reach this code.
 
This appears to be a XF URL accessed within your vBulletin directory. There may need to be a change in this add-on to prevent an explicit error, but this wasn't really a valid/expected URL. It'd probably end up being a broken page anyway.

I don't know what your vB URLs looked like (I'm assuming they were showthread.php and so on), but it might be worth using .htaccess rules in your vbulletin/ directory to redirect XF URLs back to the parent/correct location. That would avoid the error (and make them work as would normally be expected even if that error didn't happen).

Untested, but something like this might work (in the vbulletin/ directory):

Code:
RewriteEngine On
RewriteRule ^(threads)/(.*)$ https://example.com/$1/$2 [R=301,L]

This shouldn't affect actual legitimate, redirectable URLs as they shouldn't reach this code.

Huh, I'll be damned - you're right. I went back and dug out some old thread notifications and the correctly formatted URLs are still working.

My original VB urls were the 'Mod Rewrite Friendly URLs' such as:
http://www.xyz.com/vbulletin/threads/324535-501-Not-Implemented-The-requested-method-is-not-implemented-by-the-server?p=5335039#post5335039

I did attempt to add the new rule to the end of the existing htaccess (the vanilla one distributed with the mod), and it unfortunately did not help. It's (still) serving a page with the "correct" text content from xen, but no formatting or graphics. Not sure if this was the intended placement:

Code:
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]
        RewriteRule ^(threads)/(.*)$ https://www.xyz.com/$1/$2 [R=301,L]

Given these are incorrect URLs and likely some spider gone mad, I would be satisfied with them just not spamming my error log, but also curious as to why they just started hitting with the XF2.2.2 upgrade.

Thanks again @Mike
 
Because of the type of URLs you have, you're going to need a different style of rule. I think this should work (though untested):

Code:
RewriteRule ^threads/([^/.]+\.[0-9]+.*)$ https://example.com/threads/$1 [R=301,L]
(Adjust the URL in that as necessary)

In terms of the rule placement, it needs to go above this line:

Code:
RewriteRule ^.*$ index.php [NC,L]

Once applied, make sure you test both expected redirects and "bad" URLs. I would recommend doing so in an incognito window to avoid cache issues.
 
Because of the type of URLs you have, you're going to need a different style of rule. I think this should work (though untested):

Code:
RewriteRule ^threads/([^/.]+\.[0-9]+.*)$ https://example.com/threads/$1 [R=301,L]
(Adjust the URL in that as necessary)

In terms of the rule placement, it needs to go above this line:

Code:
RewriteRule ^.*$ index.php [NC,L]

Once applied, make sure you test both expected redirects and "bad" URLs. I would recommend doing so in an incognito window to avoid cache issues.

Success - thank you!
 
I have a route filter from forums/ to forum/

After installing the redirects, i'm not be able to access a forum under the route /forum/exampleforum.2 anymore. It throws a "not found". When disabling the route filter the forum is accessible again.

Is there something i can do about this?
 
The short answer is not particularly easily because that is also a route that looks like something that needs to be redirected. Assuming this relates to the forum in your signature, most of your forums actually use the "node name" approach, so they're forum/xyz/ instead of forum/xyz.123/. There is code in this add-on that detects the latter and bails out because we know it's a XenForo route, but we can't do that .

I don't know specifically the URLs you're trying to redirect. You could try the older approach to redirection with this (deprecated) add-on:


It doesn't handle as many types of URLs though so you may need some custom rewrite rules as well.
 
I have the same problem with the add-on as soon as the route is changed from "forums" to "forum".
Watch the video where the "bug" is shown.
 

Attachments

I have just migrated from VB 3.8 with VBSEO to XF2.2 thankfully all went smoothly.

I installed the new XF 2.2 in the same folder \forums\ as the old VB forum, activated the redirect add-on as per the documentation.

I'm having problems trying to get the redirect to work and wondered if someone could point me in the right direction?

for example;

The old VB url from google look like this, which give me 'The requested page could not be found.' error

The actual url for this same thread in XF is this.

I have not made any changes to the .htaccess file in the forums folder

Assuming you have already installed the XenForo Redirects for vBulletin addon, add to .htaccess file:

Code:
#this one works: rewrite old vBSEO urls and then the rewritten URL is handled by the Xenforo Redirects addon
RewriteRule [^/]+/([0-9]+)-[^/]+\.html https://turkishliving.com/forums/showthread.php?t=$1 [L,R=301]

RewriteCond %{QUERY_STRING} (^|\?|&)p=([0-9]+)($|&)
RewriteRule ^showthread\.php$ /posts/%2/? [R=301,L]
RewriteCond %{QUERY_STRING} (^|\?)([0-9]+)-[^/]+/page([0-9]+)$
RewriteRule ^showthread\.php$ /threads/%2/page-%3? [R=301,L]
RewriteCond %{QUERY_STRING} (^|\?)([0-9]+)-.*$
RewriteRule ^showthread\.php$ /threads/%2/? [R=301,L]
 
Not sure if it's my redirects or something in this add in.. but any help is appreciated.
This is on IIS..FYI

I finally upgraded to xf2, and was working though the redirect issues from the old vb urls.
(We have been around a long time and I have import tech posts dating back to the vb days so it's important for it to all work.)
Removed the old PHP files from the old Add In..
Installed this one and pointed to my log.

I have 2 web configs..
Main root and the forums folder.

Main root has a re-write for http to https.
Code:
<rule name="Redirect to HTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="false">
        <match url="*" ignoreCase="true" negate="false" />
        <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
          <add input="{HTTPS}" ignoreCase="true" matchType="Pattern" negate="false" pattern="OFF" />
        </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
      </rule>


Then in forums the normal.
Code:
<rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^.*$" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                    </conditions>
                    <action type="None" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url="^(data|js|styles|install)" />
                    <action type="None" />
                </rule>
                <rule name="Imported Rule 3" stopProcessing="true">
                    <match url="^.*$" />
                    <action type="Rewrite" url="index.php" />
                </rule>

If I go to
http://www.binderplanet.com/forums/showthread.php?t=27243&highlight=pop
it rewrites to
https://www.binderplanet.com//forums/showthread.php?t=27243&highlight=pop

Note the double // between .com and forums.
Also this gives me an "Oops! We ran into some problems."

If I go to
https://www.binderplanet.com/forums/showthread.php?t=27243&highlight=pop
With the https already there it works fine and rewrites to
https://www.binderplanet.com/forums/index.php?threads/homebrew-injector-tester.27243/
 
Last edited:
I ruled out IIS so it is XF related.
Removed all https Rewrite rules.
If I go to an Image for instance.. http or https both work nothing changes.

If I go to
it is changing to

So XF is already changing the url for the site.
OK No problem.

But any of my old vb links that I already tested it puts two "/" in the url
But an new links I test they work fine.

Is there a cache I need to rebuild?
 
I initially asked this in Installation, Upgrade, and Import Support but it was recommended I re-post here.

I'm going to be migrating our MyBB forum to Xenforo in a few weeks. Since we run a movie ratings/review community, we have a movie database in WordPress that link to discussions in the forums, something I'd rather not fix manually. A couple people on The Admin Zone as well as in a presales question I asked here said rewrite rules should be able to do this using the vBulletin redirection add-on with minor tweaks. I'm terrible at rewrite rules and I was hoping someone might be able to walk me through it. Our forum links look like this: https://forums.domain.org/showthread.php?tid=20902. (Obviously the tid number changes depending on the thread.)

Can anyone help with the tweaks to make this work?
 
Recently updated from XF1.5 to XF2.2, after having previously updated from vB4 some years ago. We have Wordpress in the web root and XF in a subdirectory. Originally vB was in the web root. Our vB redirects which worked on XF 1.5 relied on files such as showthread.php in the webroot.
So the existing vB redirects stopped working after upgrading to 2.2. How can I use this since I already have an index.php file in the webroot for wordpress?
 
Top Bottom