vBSEO member profile redirect to Xenforo profile

TheBigK

Well-known member
I just found out that the direct links to our member profiles are returning 404. These are the profiles which were created during our vB+vBSEO days. The URL structure is -

www. crazyengineers . com / forum / members / civilprincess . html

How do I redirect the URL to the correct member profile? -

www. crazyengineers. com / community / members / civilprincess.47156 / ?
 
The old vB URLs don't contain the ids?

You will need a PHP script to query the database and fetch the user_id by username, then redirect the user. I made this script for you (attached). You need to update the URL in the script.

You also need a rewrite rule to direct that URL to the script. Add this rewrite rule to your .htaccess file in the old /forum directory:

Code:
RewriteRule ^members/([^\.]+)\.html$ /community/member_redirect.php?username=$1 [R=301,L]

That should do it.
 

Attachments

The old vB URLs don't contain the ids?

You will need a PHP script to query the database and fetch the user_id by username, then redirect the user. I made this script for you (attached). You need to update the URL in the script.

You also need a rewrite rule to direct that URL to the script. Add this rewrite rule to your .htaccess file in the old /forum directory:

Code:
RewriteRule ^members/([^\.]+)\.html$ /community/member_redirect.php?username=$1 [R=301,L]

That should do it.
Hi Jake,

Thanks for this script, it works fine, but i am stuck with nginx rule.
I tried that but it does'nt work fine.


Rewrite ^members/([\d]+)/.html ^/member_redirect.php?username=$1 last;

Do you ave an idea?
 
i totaly stuck with the rewrite from vbseo to xf. i used before example:

/members/joe-352.html
/members/jake-bunce-127.html
and non-latin usernames e.g.
/members/никола-33.html

everything happened in the root of the domain. e.g.:
domain.com/members/jake-bunce-127.html

@Jake Bunce would you be so kind and help me in that matter..
thank you a lot!
 
The old vB URLs don't contain the ids?

You will need a PHP script to query the database and fetch the user_id by username, then redirect the user. I made this script for you (attached). You need to update the URL in the script.

You also need a rewrite rule to direct that URL to the script. Add this rewrite rule to your .htaccess file in the old /forum directory:

Code:
RewriteRule ^members/([^\.]+)\.html$ /community/member_redirect.php?username=$1 [R=301,L]

That should do it.
Thank you so much for this!

It works on simple usernames, but breaks on usernames containing special characters and periods. I'm mostly concerned about the period as we have quite a few users with aaa.bbb.html type usernames. Is there any way to update the regex to account for this?
 
Thank you so much for this!

It works on simple usernames, but breaks on usernames containing special characters and periods. I'm mostly concerned about the period as we have quite a few users with aaa.bbb.html type usernames. Is there any way to update the regex to account for this?

Code:
RewriteRule ^members/(.+)\.html$ /community/member_redirect.php?username=$1 [R=301,L]
 
The old vB URLs don't contain the ids?

You will need a PHP script to query the database and fetch the user_id by username, then redirect the user. I made this script for you (attached). You need to update the URL in the script.

You also need a rewrite rule to direct that URL to the script. Add this rewrite rule to your .htaccess file in the old /forum directory:

Code:
RewriteRule ^members/([^\.]+)\.html$ /community/member_redirect.php?username=$1 [R=301,L]

That should do it.
This is exactly what I need but I'm getting an extra backslash in the url and no id when it's redirected from the old url:

http://www.mysite.com/forum/members/cheryl

goes to:

http://www.mysite.com/community/members//cheryl

These are the redirects in the old forum directory:

RewriteEngine on
RewriteRule f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule f[\d]+/.+-([\d]+)/ showthread.php?t=$1 [NC,L]
RewriteRule f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]
RewriteRule f([\d]+)/ forumdisplay.php?f=$1 [NC,L]
RewriteRule ^members/([^\.]+)/$ /community/member_redirect.php?username=$1 [NC,L]
RewriteRule ^members/([^\.]+)$ /community/member_redirect.php?username=$1 [NC,L]

Any suggestions?
 
Some members were links indexed in google incorrect. as follows:

domain.com/xxx-ID/
and
domain.com/member/xxx-ID/

How do I redirect the URL to the correct member profile?
domain.com/members/xxx.ID/
 
@Firarist

Add these rules to the top of the .htaccess file in the web root of domain.com:

Code:
RewriteEngine On

RewriteRule ^([^/]+)-([0-9]+)/$ /members/$1.$2/ [R=301,L]
RewriteRule ^member/([^/]+)-([0-9]+)/$ /members/$1.$2/ [R=301,L]
 
Back
Top Bottom