Regex 将phpbb接入xenforo
我正在尝试从PHBB重定向这些URLRegex 将phpbb接入xenforo,regex,rewrite,phpbb,xenforo,Regex,Rewrite,Phpbb,Xenforo,我正在尝试从PHBB重定向这些URL 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 url http://www.example.com/threads/restauration-gambin-10n.
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 url
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]
不幸的是我找不到我的错误,有人能指出我的错误吗?谢谢。没有特定于phpBB的重定向脚本,但这些脚本可以工作: 这些脚本的基本功能是将旧ID映射到新ID。如果有适当的重写规则,它们可以使用phpBB URL。以下是为您准备的步骤: 1将这些重定向脚本上载到旧论坛位置/forum文件夹: 您只需要301config.php文件和showthread.php文件就可以重定向线程,这是最重要的 2编辑301config.php文件。取消对此行的注释,删除//并指定XF目录的路径:
// $fileDir = '/home/username/www/forums';
如果导入日志表不是默认的xf_导入日志,则可能还需要指定导入日志表的名称。它可能被命名为归档\导入\日志:
// define('IMPORT_LOG_TABLE', 'import_log_x');
3将这些重写规则添加到/forum目录下的.htaccess文件中。这是基于以前的phpBB导入。我假设您的URL采用相同的格式:
RewriteEngine on
RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$)
RewriteRule ^viewtopic\.php$ /forum/showthread.php?t=%2 [L,R=301,NC]
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]