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

XF 1.2 Redirect question (phpbb w/phpbbSEO)

Discussion in 'Installation, Upgrade, and Import Support' started by Ivar, Jul 27, 2013.

  1. Ivar

    Ivar Member

    Hi there,

    First of all, congratulations on a great forum product! I have been a phpbb user for the last 10 years, but have lately have had a lot of problems upgrading and keeping it up to date, so recently bought a licence for Xenforo. Did a test import (25.000 users, 145.000 posts) and it worked like a dream. :)

    My last hurdle before moving the live forum is the question of redirects. I will install the new Xenforo in a new folder. I will keep the IDs the same.

    Old forum: root/board
    New forum: root/community

    I have seen a post here about redirecting the standard phpbb urls, my problem is that I have phpbbSEO mod installed, so my phpbb urls are not standard and google have indexed these customs urls.

    Most of my urls have this format:
    ..and it needs to be redirected to:

    Example posts:
    needs to be redirected to:

    One forum (with the most posts, about 50.000 posts) have this format:
    needs to be redirected to:
    (This is not the same as above since the old forum has "el-" in the forum name, and the new forum does not.)

    Then I have 5 forum with this url format:
    Old forum: root/board/gear-for-sale-gear-needed-f106/
    New forum: root/community/forums/gear-for-sale-gear-needed.106/

    Old forum: root/board/camino-del-mar-f112/
    New forum: root/community/forums/camino-del-mar.112/

    Old forum: root/board/camino-castellano-aragones-f110/
    New forum: root/community/forums/camino-aragon%C3%A9s.33/

    Old forum: root/board/camino-del-sureste-f108/
    New forum: root/community/forums/camino-del-sureste.108/

    Old forum: root/board/ruta-del-ebro-f107/
    New forum: root/community/forums/ruta-del-ebro.107/

    My question is: Is it possible to write redirects in the htaccess file with one general redirect rule, then have 6 exceptions and hard code those exceptions in? (my 6 exceptions would be the 5+1 forum above).

    I hope my question makes sense... and thank you in advance for any help.

    Best regards,
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Put this in a .htaccess file (or at the top of an existing .htaccess file) in the /board directory:

    RewriteEngine On
    RewriteRule ^[^/]+/topic([0-9]+)\.html$ /community/threads/$1/ [R=301,L]
    RewriteRule ^.+-f([0-9]+)/$ /community/forums/$1/ [R=301,L]
    For those forum URLs without ids you need to do it manually. Example:

    RewriteRule ^el-camino-del-norte/$ /community/forums/el-camino-del-norte.21/ [R=301,L]
  3. Ivar

    Ivar Member

  4. Ivar

    Ivar Member

    Hi again,

    I have now done the move and we are live on Xenforo. I just realized that the htaccess works fine for the posts-rewrites, but not for the individual forums... my htaccess file is as follows:

    # Lines That should already be in your .htacess
    <Files "config.php">
    Order Allow,Deny
    Deny from All
    <Files "common.php">
    Order Allow,Deny
    Deny from All
    # You may need to un-comment the following line
    # Options +FollowSymlinks
    RewriteEngine On
    RewriteRule ^[^/]+/topic([0-9]+)\.html$ /community/threads/$1/ [R=301,L]
    RewriteRule ^.+-f([0-9]+)/$ /community/forums/$1/ [R=301,L]
    RewriteRule ^(.*) /community/ [R=301,L]
    RewriteRule ^announcements-your-feedback/$ /community/forums/announcements-your-feedback.9/ [R=301,L]
    RewriteRule ^frequently-asked-questions/$ /community/forums/frequently-asked-questions.16/ [R=301,L]
    RewriteRule ^pilgrim-introductions/$ /community/forums/pilgrim-introductions.14/ [R=301,L]
    RewriteRule ^moderator-conversations/$ /community/forums/moderator-conversations.36/ [R=301,L]
    RewriteRule ^el-camino-frances/$ /community/forums/camino-frances.12/ [R=301,L]
    RewriteRule ^camino-frances-blogs-photo-albums/$ /community/forums/camino-frances-blogs-photo-albums.59/ [R=301,L]
    RewriteRule ^camino-frances-albergues-pensions-and-hostals/$ /community/forums/camino-frances-albergues-pensions-and-hostals.80/ [R=301,L]
    RewriteRule ^el-camino-portugues/$ /community/forums/camino-portugues.13/ [R=301,L]
    ....and then it continues with a total of 94 forum rewrites. 

    Example urls:
    should re-direct to...

    ..but instead it redirects to the new forum home.

    htaccess file is located in www.caminodesantiago.me/board/


  5. Jeremy

    Jeremy Well-Known Member

    Put this line after your individual forum rewrite rules:
    RewriteRule ^(.*) /community/ [R=301,L]
    Ivar likes this.
  6. Ivar

    Ivar Member

    Genius! Thanks!

Share This Page