Resource icon

Redirection Scripts for vBulletin 3.x 8.0

No permission to download
Does this update (7.1) now do page numbers? I have been using the workaround below and all was fine. Now wanting to use the never version of the script but see the code on that page has changed.

Those redirect scripts don't do page numbers. Is your XF forum showing the same number of posts per page as your vB forum? Otherwise the page numbers won't match up so it would not be appropriate to redirect them. But if you want to include page numbers in the redirects then edit the showthread.php file and add the red code:

Rich (BB code):
if ($input['t'])
{
    if ($newId = $importModel->mapThreadId($input['t']))
    {
        $target = XenForo_Link::buildPublicLink('canonical:threads', array('thread_id' => $newId), array('page' => max(1, $inputHandler->filterSingle('page', XenForo_Input::UINT))));
    }
}

Untested, but that should work with your rewrite rules.
 
Hello,

i will have a crisis with this redirects...

vB 3.8 and xF 1.3b4 are both on the same domain but in different directorys:

vB: www.domainA.de/forum (no seo addon)
xF: www.domainA.de/xf (no seo addon)

all files from the script from Mike i copied to the www.domainA/forum directory, only the one to /forum/archive.

The 301config.php in /forum i have edited so:
PHP:
<?php

$fileDir = '/var/www/vhosts/domainA.de/httpdocs/xf';

define('IMPORT_LOG_TABLE', 'archived_import_log');

define('INCLUDE_PAGE_LINKS', true);

But when i open a old link - i will only redirect to the new xenforo installation /xf on the starting page (xenPorta). Can anyone help me please?
 
The 301config.php in /forum i have edited so:
PHP:
<?php

$fileDir = '/var/www/vhosts/domainA.de/httpdocs/xf';

define('IMPORT_LOG_TABLE', 'archived_import_log');

define('INCLUDE_PAGE_LINKS', true);

But when i open a old link - i will only redirect to the new xenforo installation /xf on the starting page (xenPorta). Can anyone help me please?

Your setup looks to be OK. Might be redundant, but is it the right Log-table name?
 
Hello,

yes it is:
redirect_errors_01.webp

Its not god, when we cannot found any solution or a work arround over a htaccess? :cautious:
 
When you have installed xenforo into a different directory and change the domain so it will point directly onto that directory instead of the vbulletin directory where it pointed before (my forum is directly on www.domain.de) then you won't need to set the $fileDir, right?
 
When you have installed xenforo into a different directory and change the domain so it will point directly onto that directory instead of the vbulletin directory where it pointed before (my forum is directly on www.domain.de) then you won't need to set the $fileDir, right?

$fileDir is for when vB and XF are in different directories. Or more generally, when the redirect scripts are not in XF's directory.
 
Would like to redirect most of my 40000+ gallery-links through .htaccess Have retained ID:s
Code:
www.doman.com/g/
to
www.doman.com/gallery/

www.doman.com/g/browseimages.php?c=504
to
www.doman.com/gallery/albums/504/

www.doman.com/g/showimage.php?i=19681
to
www.doman.com/gallery/photos/19681/

www.doman.com/g/showimage.php?imageid=19681
to
www.doman.com/gallery/photos/19681/

www.doman.com/g/showimage.php?i=19681&c=504
to
www.doman.com/gallery/photos/19681/

www.doman.com/g/showimage.php?i=19681&catid=newimages
to
www.doman.com/gallery/photos/19681/
 
@ge66

Remove (or rename) /g and /gallery.

Then add these rules to the top of the .htaccess file in your web root:

Code:
RewriteEngine On

RewriteRule ^g/$ /gallery/ [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)c=([0-9]+)$
RewriteRule ^g/browseimages\.php$ /gallery/albums/%2/ [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)i=([0-9]+)($|&)
RewriteRule ^g/showimage\.php$ /gallery/photos/%2/ [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)imageid=([0-9]+)($|&)
RewriteRule ^g/showimage\.php$ /gallery/photos/%2/ [R=301,L]

That should do it.
 
Thank you, would it be possible to remove the ? and what comes after?

g/showimage.php?imageid=19681
seemes to redirect to
gallery/photos/17439/?imageid=17439
should be
gallery/photos/17439/

same with others
gallery/photos/1341/?i=1341&catid=newimages

I have also put the following in there, do they look ok seemes to be working:
RewriteRule ^f/calendar.php$ /events/ [R=301,L]
RewriteRule ^f/register.php$ /register/ [R=301,L]
RewriteRule ^f/faq.php$ /help [R=301,L]
RewriteRule ^f/index.php$ / [R=301,L]

f/ is my old vb forumdir and I have the redirection scripts running there? Should they be in the f/ dir instead, should they then be changed?
 
@ge66

I forgot about the ?. Here is a revision to my previous rules:

Code:
RewriteEngine On

RewriteRule ^g/$ /gallery/ [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)c=([0-9]+)$
RewriteRule ^g/browseimages\.php$ /gallery/albums/%2/? [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)i=([0-9]+)($|&)
RewriteRule ^g/showimage\.php$ /gallery/photos/%2/? [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)imageid=([0-9]+)($|&)
RewriteRule ^g/showimage\.php$ /gallery/photos/%2/? [R=301,L]
 
@ge66

Your rules look fine if the /f directory doesn't exist. Otherwise the rules would go into the /f directory and you would remove "f/" from the beginning of each match since it's relative to the current directory.
 
I have two issues after migrating from vB 3.x:

1) My old vBulletin 3.x site used a lot of tags and now I've been getting a lot of 404 Not Found errors at Google Webmaster Tools. Is there any way to use .htaccess to rewrite tags to a Xenforo search? For instance:

tags/tag1%20tag2%20tag3.html would result in a search in Xenforo for "tag1 tag2 tag3"?

2) I have also been getting a lot of 404 Not Found errors for URLs like "forums/showthread?t=8054", for instance. However, I cannot leave a copy of the redirection scripts in a folder named "forums" because as I use XenPorta, if I do so, when users click on "Forums" in the navigation tab, they get a 404 Error, as was described here. Any workarounds to that?

Thanks a lot in advance!
 
@[The Piper]

1) That's possible. But search URLs are temporary and have no SEO value. A 404 is appropriate I think.

2) Please provide an example old and new thread URL. I will give you rewrite rules.
 
@Jake Bunce: Thanks for the quick reply. You know, you're probably right regarding tags.

Regarding #2:

old URL: forums/showthread.php?t=8054

new URL: /showthread.php?t=8054 (which is where the vB3 redirect script is physically located)

Here's my current .htaccess file:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.pinkfloydfan\.net
RewriteRule (.*) http://www.pinkfloydfan.net/$1 [R=301,L]
RewriteRule ^t([0-9]+)-(.*)\.html$ showthread.php?t=$1
RewriteRule ^t([0-9]+)-([0-9]+)--(.*)--([0-9]+)\.html$ showthread.php?t=$1&perpage=$2&highlight=$3&pagenumber=$4
RewriteRule ^t([0-9]+)-([0-9]+)-([0-9]+)\.html$ showthread.php?t=$1&perpage=$2&pagenumber=$3
RewriteRule ^t([0-9]+)-([0-9]+)\.html$ showthread.php?t=$1&pagenumber=$2
RewriteRule ^t([0-9]+)\.html$ showthread.php?t=$1 [NC,L]
RewriteRule ^p([0-9]+)\.html$ printthread.php?s=&t=$1 [NC,L]
RewriteRule ^f([0-9]+)-(.*)\.html$ forumdisplay.php?f=$1 [NC,L]
#    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 /xenforo
#    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>

And if I could ask you a last question, how would I achieve the following redirect?

old url: http://www.pinkfloydfan.net/f667-forums.html
new url: http://www.pinkfloydfan.net/forums

Many, many thanks in advance!!!
 
Top Bottom