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

Thread Redirection

Discussion in 'Installation, Upgrade, and Import Support' started by Oliver.n, Apr 13, 2012.

  1. Oliver.n

    Oliver.n Member

    I have moved from phpbb to xenforo, on the same website, in the same directory, phpbb files have now been removed. How do i re-direct old posts?

    (I did not do the import, my co-admin did it)
     
  2. Floris

    Floris Guest

    Read the sticky thread.
     
  3. Oliver.n

    Oliver.n Member

    Where is it?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This person recently did a phpBB import and posted his rewrite rules for redirects:

    http://xenforo.com/community/threads/phpbb-redirect-rules.30314/

    In his case he selected the option at the beginning of the import to preserve the source ids. That is why he can do a straight rewrite without using the redirect scripts.

    If you didn't preserve the source ids then you need to upload the redirect scripts and then use rewrite rules like this to map the old URLs to the redirect scripts:

    Code:
    RewriteEngine on
     
    RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
    RewriteRule ^viewtopic\.php$ showthread.php?t=%2? [L,R=301,NC]
    RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
    RewriteRule ^viewforum\.php$ forumdisplay.php?f=%1? [L,R=301,NC]
    
    If you need help with this then I can take a look if you are comfortable giving me FTP access to your server.
     
  5. Oliver.n

    Oliver.n Member

    Ok but it's not vbulletin, it's phpbb so i need to upload one of those redirect files to the root? Or do i add this to .htaccess

    RewriteEngine on

    RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
    RewriteRule ^viewtopic\.php$ showthread.php?t=%2? [L,R=301,NC]
    RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
    RewriteRule ^viewforum\.php$ forumdisplay.php?f=%1? [L,R=301,NC]
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Those scripts work for phpBB too... if you use those rewrite rules to map the URLs.
     
  7. Oliver.n

    Oliver.n Member

    Ok which one should i use then, any? Sorry, im a bit confused.
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    1) Upload these redirect scripts:

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

    2) Add these rewrite rules to your .htaccess file:

    Code:
    RewriteEngine on
     
    RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
    RewriteRule ^viewtopic\.php$ showthread.php?t=%2? [L,R=301,NC]
    RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
    RewriteRule ^viewforum\.php$ forumdisplay.php?f=%1? [L,R=301,NC]
    
    That's it. That will redirect thread and forum URLs.
     
  9. MattW

    MattW Well-Known Member

    These are mine from when I did my conversion from phpBB 3.0.10:

    both are in the /forum directory.

    Code:
            RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
            RewriteRule ^viewtopic\.php$ /forum/threads/%2? [L,R=301,NC]
            RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
            RewriteRule ^(viewforum\.php|viewtopic\.php)$ /forum/forums/%1? [L,R=301,NC]
            RewriteCond %{QUERY_STRING} (^|&)p=([0-9]+)(&|$) [NC]
            RewriteRule ^viewtopic\.php$ /forum/posts/%2? [L,R=301,NC]
    
     
  10. Oliver.n

    Oliver.n Member

    Thankyou
     
  11. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Note that Matt's redirects assume that you selected the option to preserve the source ids.
     
    MattW likes this.

Share This Page