XF 1.1 phpbb import, url redirect

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?
 
Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>
 
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default
 
<IfModule mod_rewrite.c>
    RewriteEngine On
 
    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo
 
    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
 
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$)
    RewriteRule ^viewtopic\.php$ /forum/showthread.php?t=%2 [L,R=301,NC]
</IfModule>
 
Oh I think I see the issue...

1) phpBB install was on / and then I moved it to /phpbbold
2) All thread links go to /
3) I've installed XF to /

Hmm, could I set htaccess up so it redirects to /phpbbold and then to the related thread on XF?
 
It seems you are redirecting viewtopic.php to showthread.php, which is vBulletin type URL. Try replacing this:
Code:
 RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$)
    RewriteRule ^viewtopic\.php$ /forum/showthread.php?t=%2 [L,R=301,NC]

With:
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]
 
Hmm, you might just have to wait until Jake gets on and works his magic. The only difference I see between your htaccess and mine, is that I have the phpBB rules before the xenforo ones, so mine looks more like this:
Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>
 
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default
 
<IfModule mod_rewrite.c>
    RewriteEngine On
 
    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo
 
    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    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]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
Piers and others - glad to see you working on this. I'm going to be doing the EXACT same thing with my company's internal forums as we move them external for an expanded audience (partners and eventually customers). This is foremost on my mind right now. Thanks for the continued communication and support so the rest of us can make use of it as well. :)
 
Hi guys

I'm going to be doing a phpBB to xenForo conversion soon. Arty has already posted a suggestion here regarding redirection. Will this method be OK?

As I explained in the thread linked above my phpBB url's are already SE friendly and use a structure like...

Forum: http://www.domain.com/forum/forum-name-f1.html

Topic: http://www.domain.com/forum/topic-t3337.html

Thanks :)

That works. He has basically created his own redirect rules.

I always use the vB redirect scripts:

http://xenforo.com/community/threads/phpbb-import-url-redirect.32123/#post-366972

The only difference in your case is step 3... you need different rewrite rules for your URLs. These should work:

Code:
RewriteEngine on

RewriteRule ^([a-zA-Z0-9_\-]+)-t([0-9]+)\.html$ /forum/showthread.php?t=$2 [L,R=301,NC]
RewriteRule ^([a-zA-Z0-9_\-]+)-f([0-9]+)\.html$ /forum/forumdisplay.php?f=$2 [L,R=301,NC]

This assumes phpBB used to be inside of the /forum directory, and also that XF is currently in the same directory. The redirect scripts and .htaccess file would all be inside of /forum.

If you need help just send me a PM with your FTP info. I will take care of it.
 
Code:
#cannot attach files, remove the "#" from the lines below.
 
#<IfModule mod_security.c>
 
#SecFilterEngine Off
 
#SecFilterScanPOST Off
 
#</IfModule>
 
 
 
ErrorDocument 401 default
 
ErrorDocument 403 default
 
ErrorDocument 404 default
 
ErrorDocument 500 default
 
 
 
<IfModule mod_rewrite.c>
 
RewriteEngine On
 
 
 
#If you are having problems with the rewrite rules, remove the "#" from the
 
#line that begins "RewriteBase" below. You will also have to change the path
 
#of the rewrite to reflect the path to your XenForo installation.
 
#RewriteBase /xenforo
 
 
 
#This line may be needed to enable WebDAV editing with PHP as a CGI.
 
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
 
 
 
RewriteCond %{REQUEST_FILENAME} -f [OR]
 
RewriteCond %{REQUEST_FILENAME} -l [OR]
 
RewriteCond %{REQUEST_FILENAME} -d
 
RewriteRule ^.*$ - [NC,L]
 
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
 
RewriteRule ^.*$ index.php [NC,L]
 
RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$)
 
RewriteRule ^viewtopic\.php$ /forum/showthread.php?t=%2 [L,R=301,NC]
 
</IfModule>

phpbb forum = domain.com/forum
then I move it to = domain.com/forum-old
and I install xF at domain.com/forum
 
This is what I used on mine

Code:
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^[0-9]+(\.[0-9]+){3} [OR]
        RewriteCond %{HTTP_HOST} ^mail [OR]
        RewriteCond %{HTTP_HOST} ^z22se.co.uk
        RewriteRule (.*) http://www.z22se.co.uk/forum/$1 [R=301,L]
        RewriteRule ^userpix/(.*) http://cdn.z22se.com/userpix/$1 [QSA,L]
        #      If you are having problems with the rewrite rules, remove the "#" from the
        #      line that begins "RewriteBase" below. You will also have to change the path
        #      of the rewrite to reflect the path to your XenForo installation.
        #RewriteBase /forum/
 
        #      This line may be needed to enable WebDAV editing with PHP as a CGI.
        #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
       
        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]
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
That rules almost hit the nail. Almost.

This link:
http://forum.komikanimasi.web.id/viewtopic.php?f=19&t=901

Changed to:
http://forum.komikanimasi.web.id/forum/threads/901

But the real link is:
http://forum.komikanimasi.web.id/threads/psycho-pass.901/

update:
Update.

Code:
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^[0-9]+(\.[0-9]+){3} [OR]
        RewriteCond %{HTTP_HOST} ^mail [OR]
        RewriteCond %{HTTP_HOST} ^komikanimasi.web.id
        #RewriteRule (.*) http://www.komikanimasi.web.id/forum/$1 [R=301,L]
RewriteRule (.*) http://www.forum.komikanimasi.web.id/$1 [R=301,L]
        #RewriteRule ^userpix/(.*) http://cdn.z22se.com/userpix/$1 [QSA,L]
        #      If you are having problems with the rewrite rules, remove the "#" from the
        #      line that begins "RewriteBase" below. You will also have to change the path
        #      of the rewrite to reflect the path to your XenForo installation.
        #RewriteBase /forum/
 
        #      This line may be needed to enable WebDAV editing with PHP as a CGI.
        #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
     
        RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
        RewriteRule ^viewtopic\.php$ /threads/%2? [L,R=301,NC]
        RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
        RewriteRule ^(viewforum\.php|viewtopic\.php)$ /forums/%1? [L,R=301,NC]
        RewriteCond %{QUERY_STRING} (^|&)p=([0-9]+)(&|$) [NC]
        RewriteRule ^viewtopic\.php$ /posts/%2? [L,R=301,NC]
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
</IfModule>

It works. :)

Thanks MattW. :)
 
Bumping this thread... I need these for nginx. I have tried the various online conversion tools with no success. The kicker is I already have a 301config.php and showthread.php in the root from another conversion.

I imported a phpBB 3 forum from domain.com to domain2.com

Same folder structure in each (root). I have all urls redirected from domain.com to domain2.com but not sure how to handle redirecting the old urls.

Old url: http://www.v6mustangforums.com/viewtopic.php?f=28&t=16407

I have the archived import log to map the ids saved. This is what I have in my v6mustang.com.conf file, which is what the above url should be redirecting to (v6Mustang.com)

Code:
#301 redirect non-www to www
server {
    server_name  v6mustang.com;
    rewrite ^    http://www.v6mustang.com$request_uri? permanent;
}

server {
  server_name www.v6mustang.com;

# ngx_pagespeed & ngx_pagespeed handler
include /usr/local/nginx/conf/pagespeed.conf;
include /usr/local/nginx/conf/pagespeedhandler.conf;
include /usr/local/nginx/conf/pagespeedstatslog.conf;

  # limit_conn limit_per_ip 16;
  # ssi  on;

  access_log /home/nginx/domains/v6mustang.com/log/access.log combined buffer=32k;
  error_log /home/nginx/domains/v6mustang.com/log/error.log;

  root /home/nginx/domains/v6mustang.com/public;

  location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$uri&$args;
# block common exploits, sql injections etc
#include /usr/local/nginx/conf/block.conf;

  # Enables directory listings when index file not found
  #autoindex  on;

  # Shows file listing times as local time
  #autoindex_localtime on;

  # Enable for vBulletin usage WITHOUT vbSEO installed
  #try_files        / /index.php;

  }

  location /internal_data/ {
        internal;
}
location /library/ {
      internal;
}

location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
}

location /vb/ {
    rewrite ^/vb/f[\d]+/.+-([\d]+)/index([\d]+).html /vb/showthread.php?t=$1&page=$2 last;
    rewrite ^/vb/f[\d]+/.+-([\d]+)/ /vb/showthread.php?t=$1 last;
    rewrite ^/vb/f([\d]+)/index([\d]+).html /vb/forumdisplay.php?f=$1&page=$2 last;
    rewrite ^/vb/f([\d]+)/ /vb/forumdisplay.php?f=$1 last;
}

  include /usr/local/nginx/conf/staticfiles.conf;
  include /usr/local/nginx/conf/php.conf;
  include /usr/local/nginx/conf/drop.conf;
  #include /usr/local/nginx/conf/errorpage.conf;
}

This is what I have from the old url that is simply redirecting everything to the above domain:

Code:
server {
  server_name v6mustangforums.com www.v6mustangforums.com;
rewrite ^ $scheme://www.v6mustang.com$request_uri permanent;
# ngx_pagespeed & ngx_pagespeed handler
#include /usr/local/nginx/conf/pagespeed.conf;
#include /usr/local/nginx/conf/pagespeedhandler.conf;
#include /usr/local/nginx/conf/pagespeedstatslog.conf;

  # limit_conn limit_per_ip 16;
  # ssi  on;

  access_log /home/nginx/domains/v6mustangforums.com/log/access.log combined buffer=32k;
  error_log /home/nginx/domains/v6mustangforums.com/log/error.log;

  root /home/nginx/domains/v6mustangforums.com/public;

  location / {

# block common exploits, sql injections etc
#include /usr/local/nginx/conf/block.conf;

  # Enables directory listings when index file not found
  #autoindex  on;

  # Shows file listing times as local time
  #autoindex_localtime on;

  # Enable for vBulletin usage WITHOUT vbSEO installed
  #try_files        / /index.php;

  }

  include /usr/local/nginx/conf/staticfiles.conf;
  include /usr/local/nginx/conf/php.conf;
  include /usr/local/nginx/conf/drop.conf;
  #include /usr/local/nginx/conf/errorpage.conf;
}
 
There are phpBB redirect scripts in a resource: http://xenforo.com/community/resources/redirection-script-for-phpbb-3-0-x-without-seo-urls.2326/

You'd just install those at the original location (you'll likely need to point a path to the XF files though; I haven't checked how those scripts work).

I have tried those. The problem is I don't think those work unless it was a fresh import retaining ids right?

We imported a phpBB forum into an existing forum and from the looks of Jakes post above, we need to be using the vB redirects with the 301config and showthread... plus his rewrites he added. Unfortunately the rewrites aren't working.

Since we already have a 301config.php from another conversion in the root directory, I renamed 301config.php to 301config_phpbb.php and renamed showthread.php to showthread_phpbb.php. I then opened up showthread_phpbb.php and changed the line to call 301config_phpbb.php.

I made sure paths were correct in 301config_phpbb.php and then tried to convert this:

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]

to nginx with no luck.
 
Top Bottom