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

XF 1.3 Redirecting from PhpBB

Discussion in 'Installation, Upgrade, and Import Support' started by Kean, May 29, 2014.

  1. Kean

    Kean Member

    Hello,

    I am about to buy over a forum and we're about to finalize the deal. The forum is currently using phpbb with the default urls (non-SEO friendly).

    I would like to know how do I redirect the urls to seo friendly xf urls just before I take over the forum so that I'll be able to make the move asap.

    I've read a couple of threads but am still a little confused as to which code to use.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There are lots of examples if you search. But redirects are always specific to your site. If you post an example old and new thread URL (the same thread from both phpBB and XF) then I can provide exact instructions for your redirects.
     
  3. Kean

    Kean Member

    Hello Jake, here are the examples of old and new URLs.

    Old: viewtopic.php?f=18&t=389
    New: threads/forum-upgrades-login-issues.389/

    Is there also a way to redirect the forum URLs itself? For example, from:

    Old: viewforum.php?f=18
    to
    New: forums/announcements.18/
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

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

    Code:
    RewriteEngine On
    
    RewriteCond %{QUERY_STRING} (^|\?)f=([0-9]+)&t=([0-9]+)($|&)
    RewriteRule ^viewtopic\.php$ /threads/%3/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} (^|\?)f=([0-9]+)($|&)
    RewriteRule ^viewforum\.php$ /forums/%2/? [R=301,L]
    
     
    maszd likes this.
  5. clove28

    clove28 Active Member

  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Slightly different since you don't use friendly URLs.

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

    Code:
    RewriteEngine On
    
    RewriteCond %{QUERY_STRING} (^|\?)f=([0-9]+)&t=([0-9]+)($|&)
    RewriteRule ^viewtopic\.php$ /index.php?threads/%3/ [R=301,L]
    
    RewriteCond %{QUERY_STRING} (^|\?)f=([0-9]+)($|&)
    RewriteRule ^viewforum\.php$ /index.php?forums/%2/ [R=301,L]
    
     
  7. clove28

    clove28 Active Member

    I could not find the .htaccess file. Is it the same with htaccess.txt?

    I'm still getting 404 error..:(
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Then create a .htaccess file in your web root.
     
  9. clove28

    clove28 Active Member

    Do i just need to put those code or with codes from the htaccess.txt? Does htaccess.txt is just the same with .htaccess?
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Just the code I posted. No other code is needed when creating a new .htaccess file.
     
    clove28 likes this.
  11. clove28

    clove28 Active Member

    Waaahh!!!!! I just realized that I could not see the .htaccess file because it was hidden. I kept changing the htaccess.txt not realizing I wa editing the wrong file. Now it works perfectly! I'm really happy! Thanks a lot!
     
  12. Rob

    Rob Well-Known Member

    How could I redirect page 2, 3, x of viewforum and viewtopic assuming the pagination stayed the same?
     
  13. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I can provide exact rules if you give me an example old and new URL.
     
  14. Rob

    Rob Well-Known Member

    Thanks Jake, all sorted now.

    I'm only redirecting first 10 pages as otherwise I'd have to use a rewritemap.
     

Share This Page