• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Redirect VBSEO to Xenforo (Nginx)

younes

Active member
#1
hello guys
i want redirect my current VBSEO urls to Xenforo
VBSEO thread example:
http://www.domain.com/thread145257.html
VBSEO forums Example:
http://www.domain.com/forum299.html
i use this http://tools.geekpoint.net/xfseo/ to convert my VBSEO links
RewriteRule thread([\d]+)-([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule thread([\d]+).html showthread.php?t=$1 [NC,L]
RewriteRule forum([\d]+)-([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]
RewriteRule forum([\d]+).html forumdisplay.php?f=$1 [NC,L]

but it's not working :(
thanks
 

rainmotorsports

Well-known member
#2
Going to have to get the rules converted for NGINX as it doesn't support apaches rewrite engine rules. I have seen quite a few people here get help on this though.
 

younes

Active member
#4
its strange
i dont know why its not working
this is my nginx config
Code:
server {
listen *:80;
server_name www.domain.com;
rewrite ^/(.*) http://domain.com/$1 permanent;
}
server {
listen *:80;
server_name domain.com;
root /home/username/www;
location / {
index index.php;
try_files $uri $uri/ /index.php?$uri&$args;
rewrite thread([\d]+)-([\d]+).html /showthread.php?t=$1&page=$2 break;  
rewrite thread([\d]+).html /showthread.php?t=$1 break;   
rewrite forum([\d]+)-([\d]+).html /forumdisplay.php?f=$1&page=$2 break;   
rewrite forum([\d]+).html /forumdisplay.php?f=$1 break;
}
location /(data|internal_data|library)/ {
allow 127.0.0.1;
deny all;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;

}
 

rainmotorsports

Well-known member
#6
One thing did you download the files and put them in the directory?
Copy the rewrite rules given below to your .htaccess file in the same directory where you have placed showthread.php and forumdisplay.php files provided by Kier: Redirection Scripts for vBulletin 3.x. If you already have some rewrite rules in that .htaccess file, place these near the top.
The redirects from that site require the files even once converted for nginx. Its possible even with them you may still have something wrong. But I figured I would ask the obvious question did you get and put the files where they go.
 

younes

Active member
#7
One thing did you download the files and put them in the directory?


The redirects from that site require the files even once converted for nginx. Its possible even with them you may still have something wrong. But I figured I would ask the obvious question did you get and put the files where they go.
i think that files is for VB3 ( is it working on VB4?)
i have VB4 + VBSEO
my htaccess:
 
Last edited by a moderator:

younes

Active member
#8
anyone ? :(
i lost 250.000+ links
i'm not expert, i paid for fix, if anyone can fix my problem send me pm please
it's urgent!
 

Jake Bunce

XenForo moderator
Staff member
#9
Assuming XF is also installed in the web root (http://www.domain.com/), and assuming the ids are the same, try this:

Code:
        location ~* ^/thread[0-9]+\.html$ {
                rewrite thread([0-9]+)\.html$ /threads/$1/ permanent;
        }

        location ~* ^/forum[0-9]+\.html$ {
                rewrite forum([0-9]+)\.html$ /forums/$1/ permanent;
        }
 

younes

Active member
#10
Assuming XF is also installed in the web root (http://www.domain.com/), and assuming the ids are the same, try this:

Code:
        location ~* ^/thread[0-9]+\.html$ {
                rewrite thread([0-9]+)\.html$ /threads/$1/ permanent;
        }

        location ~* ^/forum[0-9]+\.html$ {
                rewrite forum([0-9]+)\.html$ /forums/$1/ permanent;
        }
thank you jake, it's working now (no More 404 :D )
but my thread IDs in XF not the same as VB :( its redirecting to the wrong thread
 

Jake Bunce

XenForo moderator
Staff member
#11
thank you jake, it's working now (no More 404 :D )
but my thread IDs in XF not the same as VB :( its redirecting to the wrong thread
Then upload these redirect scripts to your web root:

http://xenforo.com/community/resources/redirection-scripts-for-vbulletin-3-x.264/

If your import records are not in the xf_import_log table then you need to edit the 301config.php file to specify the name of the table.

Then use these rules instead of the previous ones I posted:

Code:
        location ~* ^/thread[0-9]+\.html$ {
                rewrite thread([0-9]+)\.html$ /showthread.php?t=$1 permanent;
        }

        location ~* ^/forum[0-9]+\.html$ {
                rewrite forum([0-9]+)\.html$ /forumdisplay.php?f=$1 permanent;
        }
That will handle the change of id.
 

younes

Active member
#13
hello again :D
i have a new problem
how can redirect old thread pages to xenforo?
i have too many big thread with +15 pages
example:
this link redirect correctly
www.mysite.com/thread12978.html
www.mysite.com/threads/11521

but threads internal pages wont (error 404)
www.mysite.com/thread12978-2.html
www.mysite.com/threads/11521/page-2

how can fix this?
it's not important to redirected to exact page
i mean if this link www.mysite.com/thread12978-2.html can be redirected to this link www.mysite.com/threads/11521 its ok for me :D
thanks
 

Jake Bunce

XenForo moderator
Staff member
#14
hello again :D
i have a new problem
how can redirect old thread pages to xenforo?
i have too many big thread with +15 pages
example:
this link redirect correctly
www.mysite.com/thread12978.html
www.mysite.com/threads/11521

but threads internal pages wont (error 404)
www.mysite.com/thread12978-2.html
www.mysite.com/threads/11521/page-2

how can fix this?
it's not important to redirected to exact page
i mean if this link www.mysite.com/thread12978-2.html can be redirected to this link www.mysite.com/threads/11521 its ok for me :D
thanks
(to replace the previous rules I posted)

Code:
        location ~* ^/thread[0-9\-]+\.html$ {
                rewrite thread([0-9]+)-([0-9]+)\.html$ /showthread.php?t=$1&page=$2 permanent;
                rewrite thread([0-9]+)\.html$ /showthread.php?t=$1 permanent;
        }

        location ~* ^/forum[0-9]+\.html$ {
                rewrite forum([0-9]+)\.html$ /forumdisplay.php?f=$1 permanent;
        }
Then be sure to make this change to the showthread.php file:

http://xenforo.com/community/thread...rect-from-vb4-2-with-vbseo.45667/#post-490490

And make sure the number of posts per page is the same as your old forum such that the page redirects are appropriate:

Admin CP -> Home -> Options -> Messages -> Messages Per Page
 

Jake Bunce

XenForo moderator
Staff member
#16
Is this true? For that you must use the v3 files + rewrites and not the vb4 redirect files?
The vB3 and vB4 redirect scripts are almost the same.

All redirects are a little different. If you are having trouble then I can provide instructions if you give me an example old and new URL.
 

younes

Active member
#19
Then upload these redirect scripts to your web root:

http://xenforo.com/community/resources/redirection-scripts-for-vbulletin-3-x.264/

If your import records are not in the xf_import_log table then you need to edit the 301config.php file to specify the name of the table.

Then use these rules instead of the previous ones I posted:

Code:
        location ~* ^/thread[0-9]+\.html$ {
                rewrite thread([0-9]+)\.html$ /showthread.php?t=$1 permanent;
        }

        location ~* ^/forum[0-9]+\.html$ {
                rewrite forum([0-9]+)\.html$ /forumdisplay.php?f=$1 permanent;
        }
That will handle the change of id.
Hello again :D
I change my PHP version from 5.4 to 7.0.2
Now every old URL's redirected to the index :(
 

Jake Bunce

XenForo moderator
Staff member
#20
Code:
        location ~* ^/[0-9]+-[^\.]+\.html$ {
                rewrite /([0-9]+)-[^\.]+\.html$ /showthread.php?t=$1 permanent;
        }

        location ~* ^/forum[0-9]+-[^\.]+\.html$ {
                rewrite forum([0-9]+)-[^\.]+\.html$ /forumdisplay.php?f=$1 permanent;
        }

        location ~* ^/member[0-9]+\.html$ {
                rewrite member([0-9]+)\.html$ /member.php?u=$1 permanent;
        }