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

XF 1.1 phpbb import, url redirect

Discussion in 'Installation, Upgrade, and Import Support' started by Nudaii, May 29, 2012.

  1. Nudaii

    Nudaii Well-Known Member

    howdy i am just moving a forum from phpbb to xenforo

    the old folder was /forum

    its doing to be top level now aka domain.com/

    what would i need to redirect old urls to new etc?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    I think you need something like this in your .htaccess file:

    Code:
    RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
    RewriteRule ^/forum/viewtopic\.php$ /threads/%2? [L,R=301,NC]
    RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
    RewriteRule ^/forum/viewforum\.php$ /forums/%1 [L,R=301,NC]
     
    Nudaii and Jake Bunce like this.
  3. Nudaii

    Nudaii Well-Known Member

    thanks i'll check back once i do the move :)

    just copying features etc
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There are no phpBB-specific redirect scripts, but I just use these:

    http://xenforo.com/community/threads/redirection-scripts-for-vbulletin-3-x.5030/

    The basic function of these scripts is to map the old ids to the new ones. They can work with phpBB URLs given appropriate rewrite rules. Here are steps for you:

    1) Upload these redirect scripts to your old forum location (the /forum folder):

    http://xenforo.com/community/threads/redirection-scripts-for-vbulletin-3-x.5030/

    You only need the 301config.php file and the showthread.php file to redirect threads (which are the most important thing).

    2) Edit the 301config.php file. Uncomment this line (remove the //) and specify the path to your XF directory:

    Code:
    //	$fileDir = '/home/username/www/forums';
    
    You may also need to specify the name of the import log table if it's not the default (xf_import_log). It may be named archived_import_log:

    Code:
    //	define('IMPORT_LOG_TABLE', 'import_log_x');
    
    3) Add these rewrite rules to your .htaccess file in the /forum directory. This is based on previous phpBB imports. I assume your URLs follow the same format:

    Code:
    RewriteEngine on
     
    RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$)
    RewriteRule ^viewtopic\.php$ /forum/showthread.php?t=%2 [L,R=301,NC]
    
    If you have trouble with this then I can take a look if you give me FTP access to your server.
     
    Yorick likes this.
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That assumes you selected the option during the import to preserve the source ids. Otherwise you need the redirect scripts to map the ids.
     
    Nudaii and Yorick like this.
  6. Nudaii

    Nudaii Well-Known Member

    thanks guys :)
     
  7. MagnusB

    MagnusB Well-Known Member

    The redirect only works for certain content (the important ones though, like threads and forums, categories might not redirect properly depending on your setup). Be sure to check off Retain imported content IDs, otherwise it won't work at all.

    Mine is:
    Code:
            RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
            RewriteRule ^viewtopic\.php$ /threads/%2? [L,R=301,NC]
            RewriteCond %{QUERY_STRING} (^|&)p=([0-9]+)(&|$) [NC]
            RewriteRule ^viewtopic\.php$ /posts/%2? [L,R=301,NC]
            RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
            RewriteRule ^viewforum\.php$ /forums/%1 [L,R=301,NC]
    I have added one for posts as well (viewtopic.php?p=xxxx), as phpBB creates quite a few of duplicate URLs.
     
    innovaciones and Nudaii like this.
  8. xenTheory

    xenTheory Active Member

    Wow this looks pretty complicated, thought it was mean't to be easier with XenForo...
     
  9. Chris D

    Chris D XenForo Developer Staff Member

    No one has ever said XenForo makes rewriting URLs easy :)

    XenForo makes a lot of things easier. The process of importing your board is made easier because of the XenForo import scripts.

    The URL redirection mentioned in this thread is made possible using mod_rewrite which is a module of Apache - nothing at all to do with XenForo.
     
  10. xenTheory

    xenTheory Active Member

    True, I really should have looked more into first before buying a license.
     
  11. Chris D

    Chris D XenForo Developer Staff Member

    What is it exactly you need help with?

    Moving from any forum software to any other forum software is going to be pretty much the same process regardless of the starting software and the resulting software.

    So if you were to move from PHPBB to SMF or from vBulletin to PHPBB or any combination, the steps are pretty similar.

    Import wise, the functionality is built in and is pretty straight forward.

    To then redirect your old URLs to new URLs is also the same regardless of software. It will always require the use of .htaccess and mod rewrite.

    But, as daunting as it looks, it's quite easy. In fact, you don't even need to understand it yourself. If you post an example of exactly what you're trying to do I'm sure I or my fellow XenForo'ers will be happy to help :)
     
  12. xenTheory

    xenTheory Active Member

    Thank you for the reply. I'm currently running phpBB 3.x - quite a few links have been posted around so I would ideally like to keep the thread and post links working. I have just closed the phpBB forum and am importing everything into a new XF installation. I've taken a look at the guide above and I think I can do it, although it only mentions threads and not posts but I imagine the process is similar. Can you confirm that at all?

    Thanks again for the help and quick reply.

    Piers
     
  13. MagnusB

    MagnusB Well-Known Member

    The terminology from phpBB and xF is a bit different. Threads = topics, posts are posts, though threads contain posts, if that makes sense.
     
  14. xenTheory

    xenTheory Active Member

    Ah I see, well in that case I *think* I mean retaining the forum and topic links then. I think.
     
  15. xenTheory

    xenTheory Active Member

    What does the "Retain content IDs" feature do?
     
  16. MagnusB

    MagnusB Well-Known Member

    The code above retains those links, or redirects them. Only thing that isn't working is links to categories, IIRC. The URL structure for phpBB and xF are different, so you need to redirect them some way or another.
     
  17. xenTheory

    xenTheory Active Member

    Thanks, running the importer now. It's best to move over to XF before the forum gets any larger I think. It only has a couple of thousand users at the moment and around 8k posts so hopefully most links should work once I've done the bit above.
     
  18. MagnusB

    MagnusB Well-Known Member

    It retains the ID's, so the same threads / posts have the same ID in the different softwares. Basically, in viewtopic.php?f=yyy&t=xxx, yyy is the ID for the forum, xxx is the ID of the topic, a bit simplified.
     
  19. xenTheory

    xenTheory Active Member

    Everything imported, styles etc moved from test forum. Now to see about the phpBB -> XF redirects above
     
  20. xenTheory

    xenTheory Active Member

Share This Page