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

XF 1.1 Can't get the redirect from phpBB to work

Discussion in 'Installation, Upgrade, and Import Support' started by Hilmer, Mar 3, 2012.

  1. Hilmer

    Hilmer Active Member

    I can't get the redirect to work. Nothing happens when I enter the old forum
    :(

    I would like to redirect users that enter our old phpBB forum direct at www.hilmer-koch.dk/foto-forum
    to the new Xenforo one at www.hilmer-koch.dk/forum
    It would be perfect not to loose the page ranking in the search engines but I don't know how a redirect will affect this?
    I have tried this code:

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

    So not this is how my htaccess file looks:
    # # Uncomment the statement below if you want to make use of # HTTP authentication and it does not already work. # This could be required if you are for example using PHP via Apache CGI. #
    #<IfModule mod_rewrite.c>
    #RewriteEngine on
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    #</IfModule>

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

    MattW Well-Known Member

    Based on this

    Code:
    RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC] 
    RewriteRule ^viewtopic\.php$ /foto-forum/threads/%2? [L,R=301,NC] 
    RewriteCond %{QUERY_STRING} f=(\d+)$ [NC] 
    RewriteRule ^viewforum\.php$ /foto-forum/forums/%1 [L,R=301,NC]
    
    You are telling the .htaccess file to re-direct them back into the old forum directory

    You will need to add a .htaccess file into the OLD forum directory, foto-forum and use that to re-direct them back to the new forum directory.

     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Did you select the option during the import to preserve the source ids?

    Try removing the red parts:

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

    Hilmer Active Member

    Okay guys - thank for the replies.

    As you can see from my .htaccess file I have already tried to add the code and I have also tried with forum instead og foto-forum
    The .htaccess file is in the /foto-forum root dir.

    The old one was /foto-forum and the new one is forum.

    Nothing happens, when I enter the old forum.

    Jake - I cant remember, how can I find out?

    All the best
    Morten
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The .htaccess file needs to be in the foto-forum/ directory.

    I can take a look if you are comfortable giving me FTP access to your server.
     
  6. Hilmer

    Hilmer Active Member

    Attached Files:

  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That's a doc file. It should be named ".htaccess", and it should be a plain text file.
     
  8. Hilmer

    Hilmer Active Member

    I know - just renamed it because I thought I could upload it here then :)
     
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Try removing the carrots like I posted before:

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

    Hilmer Active Member

    Strange - nothing works :(

    Now my file is named .htaccess placed in the main forum folder, and it looks like this:



    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$ /forum/forums/%1 [L,R=301,NC]

    (n)
     
  11. Corwin

    Corwin Member

  12. Hilmer

    Hilmer Active Member

    This is really driving me crazy!

    The old PHPbb3 forum and the new Xenforo is on the same server, and on the same homepage - www.hilmer-koch.dk.

    the old is /foto-forum
    the new /forum

    When a user enter the old forum (/foto-forum) I would like the adress to change to the new one (/forum) without delay.

    I have tried to make a .htaccess file that contains this code and placed it in the /foto-forum root. (old forums root)

    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$ /forum/forums/%1 [L,R=301,NC]
     
  13. Corwin

    Corwin Member

    It will not work that way.
     
  14. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I can take a look if you give me a FTP login to your server.
     
  15. Hilmer

    Hilmer Active Member

    Hi Jake that is so kind of you. I ask our server guy and I am not allowed to give the information :(
    It just makes it even harder to find the solution.

    Corvin - How will it work then? I thought it would redirect the users...

    All the best
    Morten
     
  16. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That's understandable. But I am certain that I could get it working if you give me access. I have setup redirects for many sites.

    The problem with redirects is that there are many points of failure.
     
  17. MagnusB

    MagnusB Well-Known Member

    Seems you got it working now :)

    Just wanted to let you know, I discovered that since phpBB generates so many double URL's, there is one more rule you might want to consider adding:

    Code:
            RewriteCond %{QUERY_STRING} (^|&)p=([0-9]+)(&|$) [NC]
            RewriteRule ^viewtopic\.php$ /posts/%2? [L,R=301,NC]
    That one will redirect direct links to posts, not threads, to Xenforo (e.g. viewtopic.php?f=1&p=1). I think I semi understood Corvin's original rule, and it seems to work on my site.
     
  18. Hilmer

    Hilmer Active Member

    Jake you are the man:) Thanks for fixing it all for me - thats amazing.
    I am so glad I got the permission to let you enter our server (y)
     

Share This Page