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

vBSEO member profile redirect to Xenforo profile

Discussion in 'Installation, Upgrade, and Import Support' started by TheBigK, Dec 30, 2012.

  1. TheBigK

    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 / ?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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:

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

    Attached Files:

    NUT65, SimonV and Fred. like this.
  3. TheBigK

    TheBigK Well-Known Member

    Hello Jake,

    That's awesome. Could you please confirm that I need to update this URL -

    if ($userId)
    header ('HTTP/1.1 301 Moved Permanently');
    header ('Location: [B]http://www.yoursite.com/members/[/B]' $userId);
    'user not found';
    Should this be changed to http:// www.crazyengineers.com / forum / members / ? Or should I switch it to http://www.crazyengineers.com/community/members/ ?
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    /community is your XF forum, right? So use /community
  5. TheBigK

    TheBigK Well-Known Member

    Right /community -> XF
    /forum/ -> old vB. I'll make it community then.
  6. TheBigK

    TheBigK Well-Known Member

    ...and where exactly should I upload the attached script? In the XF root or old vB root?
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    In the XF root, in /community
  8. TheBigK

    TheBigK Well-Known Member

  9. Sidane

    Sidane Active Member

    This is very useful, thanks for the script @Jake Bunce
    Jake Bunce likes this.
  10. oloman

    oloman Active Member

    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?
  11. oloman

    oloman Active Member

    I got it
    rewrite ^/members/([a-zA-Z_0-9\-]+).html /member_redirect.php?username=$1 last;
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member


    Please provide a real example of an old and new member URL so I can confirm your rules.

    edit - nm
  13. oloman

    oloman Active Member

    it was domain.com/members/joe.html
  14. Nicky

    Nicky Active Member

    i totaly stuck with the rewrite from vbseo to xf. i used before example:

    and non-latin usernames e.g.

    everything happened in the root of the domain. e.g.:

    @Jake Bunce would you be so kind and help me in that matter..
    thank you a lot!
  15. insocial

    insocial Member

    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?
  16. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

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

    cherylferraro Member

    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:


    goes to:


    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?
  18. insocial

    insocial Member

    Cool, seems to work much better. Thanks!
  19. Firarist

    Firarist Member

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


    How do I redirect the URL to the correct member profile?
  20. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member


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

    RewriteEngine On
    RewriteRule ^([^/]+)-([0-9]+)/$ /members/$1.$2/ [R=301,L]
    RewriteRule ^member/([^/]+)-([0-9]+)/$ /members/$1.$2/ [R=301,L]
    Firarist likes this.

Share This Page