Resource icon

Redirection Scripts for vBulletin 3.x 8.0

No permission to download
These scripts use the import log which stores the old-new ID mapping, so it should work.
 
I have a question. In the file attachment.php you have this code:
PHP:
        if ($input['thumb'])
        {
            /* @var $attachmentModel XenForo_Model_Attachment */
            $attachmentModel = XenForo_Model::create('XenForo_Model_Attachment');

            if ($attachment = $attachmentModel->getAttachmentById($input['attachmentid']))
            {
                $target = XenForo_Link::convertUriToAbsoluteUri($attachmentModel->getAttachmentThumbnailUrl($attachment));
            }
        }
        else
        {
            $target = XenForo_Link::buildPublicLink('canonical:attachments', array('attachment_id' => $newId));
        }
But don't you mean:
PHP:
if ($attachment = $attachmentModel->getAttachmentById($newId))
?

Otherwise I believe linking to the thumbnail would only work when you decide to retain IDs.
 
Last edited:
Hello,
Thanks very much for these scripts. They are working well for us as we test a new dev site we are launching soon. I had a question - it appears that these scripts are first redirecting to a XF url with the ID only and then XF is redirecting again to go to the friendly forum URL with the slug in it. Is this the way it should be working or should these scripts be figuring out the friendly URL w/ slug and including that in the first redirect? Just wanted to confirm if it is something maybe i dont' have setup properly or if that is normal.

So right now:
/forumdisplay.php?f=294 redirects to /forums/294 and then there is another redirect to /forums/forum-slug-here.294

I don't think the double redirect is a major issue but just want to setup as best as possible. If i can get it down to one seems better. Thanks in advance!
 
I had a question - it appears that these scripts are first redirecting to a XF url with the ID only and then XF is redirecting again to go to the friendly forum URL with the slug in it. Is this the way it should be working or should these scripts be figuring out the friendly URL w/ slug and including that in the first redirect
Yes, this is expected. Notably, this is to prevent a potential information leak (title of non-visible threads).
 
I preserved my content IDs. Any version of these scripts that skips the table lookup?
You should probably look at direct rewrites via .htaccess then, bypassing redirection scripts entirely.

I can just change that one line in attachment.php as suggested by Ralle to "install" the update, correct?
Yes. It's a definite edge case though, as it's specific to attachment thumbnail embeds (which I suspect are quite rarely needed based on no one noticing this for so long :)).
 
Good day to you all,

I have been trying for months to move my forum vbulletin 3.8 .4 + vBSEO towards xenForo 1.5 on a machine where it runs windows server 2008 r2 with iis 7.5 with PHP Fast-cgi, but I can not find a solution.
I do not want to lose the links redirect, so each test I do with negative results then return to the old forum.

I put the XML file into the Tool vBSEO http://tools.geekpoint.net/xfseo/

This is the result:

Code:
RewriteEngine on
RewriteRule [^ /] + / ([\ d] +) -. + -.? ([\ D] +) html showthread.php t = $ 1 & page = $ 2 [NC, L]
RewriteRule [^ /] + / ([\ d] +) - ..? + Html showthread.php t = $ 1 [NC, L]

I did all the tests with .htacess, I think since I have a windows server with IIS, the rewrite should be included in the web.config, I do not know how to do

This is an example url from vbulletin:
http://www.website.info/forum/485-adsl-wireless-barbarano-e-torre-vado-nel.html

you should turn into xenForo:

http://www.website.info/forum/threads/adsl-wireless-a-barbarano-e-torre-vado-nel-salento.485/

I also created the "archived_import_log" table during transfer

I hope someone can help me

Thank you
 
I did all the tests with .htacess, I think since I have a windows server with IIS, the rewrite should be included in the web.config, I do not know how to do
There's are some tools to convert mod_rewrite rules to IIS web.config rules:

http://www.iis.net/learn/extensions/url-rewrite-module/importing-apache-modrewrite-rules
http://cbsa.com.br/tools/online-convert-htaccess-to-web-config.aspx

I can't speak to the accuracy of these tools, but they should be a start.

Assuming you have the default/recommended web.config in place (https://xenforo.com/help/friendly-urls/), you would likely put those rules first.
 
Thanks for the reply,
I tried both converters, I can not make it work, just activated the rules, the forum does not open, leaves a blank screen.

there a way to use as a custom 404 error page? a page that is located outside the forum folder.
that way I could create a script on the page using the current index in the url, send it with a 301 redirect to the new page.

what do you think about it?

Thank you
 
Hey guys,

the redirect script is working perfectly, thanks a lot!
Problem is (or maybe it's not a problem at all?!): we are using vBSEO and our Google search results are using the rewritten Urls which basically makes the redirects of this script useless.

Would you guys rewrite the vBSEO Urls to point to this script and then do a redirect or would you redirect them directly?
 
Would you guys rewrite the vBSEO Urls to point to this script and then do a redirect or would you redirect them directly?
If your IDs aren't the same, you have no choice but to rewrite them to this script. But if you have the confidence to rewrite them directly, then that would suffice as well. It's essentially the same thing (particularly if it's just an internal call to these scripts, rather than an extra 301).
 
If you don't control the old URL, the value of the redirects is definitely reduced as it prevents them from working for any external links.

But if you've simply rewritten them to a different URL, you should place the redirects to cover that URL. You don't need your old database.
 
But if you've simply rewritten them to a different URL, you should place the redirects to cover that URL. You don't need your old database.
Thank you Mike. I've already placed the redirects but redirection is not working the way I expect or maybe I am doing the wrong way.

It simply redirects the URL to my Xenforo domain, and the post number remains the same.
Say if I have a URL
http://localhost/forum/showthread.php?p=288870#post288870
It redirects me to:
localhost/xenforo/#post288870

and this is not the appropriate format so it only opens the index page of my xenforo forum.
apart from the URL format the numbering is also different, i.e if I use VB post numbering with Xenforo URL format, it takes me to wrong post.
 
Last edited:
It's not totally possible to redirect #hash links as that part of the URL isn't sent to the server. However, that's not your key issue: the issue you're having is likely down to the 301config.php not being setup correctly. Specifically, you need to point it at the correct import log.
 
Top Bottom