htacces phpbb到xenforo

时间:2015-04-26 11:35:15

标签: regex rewrite phpbb xenforo

我正在尝试重定向这些网址(来自phphbb)

http://www.example.com/fraiseuses/restauration-gambin-10n-t33924-45.html
http://www.example.com/fraiseuses/une-gambin-10n-plus-sur-forum-t34642.html#p675680 

到正确的xenforo网址

http://www.example.com/threads/restauration-gambin-10n.33924/page-3
http://www.example.com/threads/34642/page-1#post-675680

我的htacces

RewriteEngine On

RewriteRule ^post([0-9]+).html$ /posts/$1 [R=301,L]
RewriteRule ^.*-f([0-9]+)$ /forums/$1 [R=301,L]
RewriteRule ^[^/]+/topic([0-9]+).html /threads/$1 [R=301,L]
RewriteRule ^.*-t([0-9]+).html /threads/$1 [R=301,L]


RewriteRule ^[^/]+/[^\./]+-t([0-9]+)-15\.html$ /threads/$1/page-1 [R=301,L]
RewriteRule ^[^/]+/[^\./]+-t([0-9]+)-30\.html$ /threads/$1/page-2 [R=301,L]
RewriteRule ^[^/]+/[^\./]+-t([0-9]+)-45\.html$ /threads/$1/page-3 [R=301,L]

不幸的是我无法找到我的错误,有人可以指出我的错误吗?感谢。

2 个答案:

答案 0 :(得分:1)

没有特定于phpBB的重定向脚本,但这些脚本将起作用::

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

这些脚本的基本功能是将旧ID映射到新ID。在适当的重写规则下,他们可以使用phpBB URL。以下是适合您的步骤:

1)将这些重定向脚本上传到您的旧论坛位置(/ forum文件夹):

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

您只需要301config.php文件和showthread.php文件来重定向线程(这是最重要的事情)。

2)编辑301config.php文件。取消注释该行(删除//)并指定XF目录的路径:

//  $fileDir = '/home/username/www/forums';

如果它不是默认值(xf_import_log),您可能还需要指定导入日志表的名称。它可以命名为archived_import_log:

//  define('IMPORT_LOG_TABLE', 'import_log_x');

3)将这些重写规则添加到/ forum目录中的.htaccess文件中。这是基于以前的phpBB导入。我假设您的网址采用相同的格式:

RewriteEngine on

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

答案 1 :(得分:0)

THX

我这样做了:

 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]
    RewriteRule ^viewforum\.php$ /forums/%1? [L,R=301,NC]