IPB 3.4.1 适用于中文论坛的URL伪静态修改方法

Xiao.T

Xiao.T

管理员
技术员
2008-05-19
6,008
6,531
移除IPB默认标题URL

修改后URL效果
http://www.ziy.cc/forum/47/
http://www.ziy.cc/topic/22600/
http://www.ziy.cc/user/10556/


修改方法
打开目录跟下initdata.php
在?>前添加




define( 'IPB_USE_ONLY_ID_FURL', TRUE );
define( 'IPB_USE_SEO_TRANSLIT', TRUE );


打开admin/applications/forums/extensions/furlTemplates.php
替换或者修改
大家自己对比代码

$_SEOTEMPLATES = array(

'showannouncement' => array( 'app' => 'forums',
'allowRedirect' => 1,
'out' => array( '#showannouncement=(.+?)((?:&|&)f=(.+?))?(&|$)#i', 'forum-$3/announcement-$1/$4' ),
'in' => array( 'regex' => '#/forum-(\d+?)?/announcement-(\d+?)(/|$)#i',
'matches' => array( array( 'showannouncement', '$2' ), array( 'f', '$1' ) ) ) ),

'showforum' => array( 'app' => 'forums',
'allowRedirect' => 1,
'isPagesMode' => 1,
'out' => array( '#showforum=(.+?)(&|$)#i', 'forum/$1/$2' ),
'in' => array( 'regex' => '#^/forum/(\d+?)(/|$)#i',
'matches' => array( array( 'showforum', '$1' ) ) ) ),


'showtopic' => array( 'app' => 'forums',
'allowRedirect' => 1,
'isPagesMode' => 1,
'out' => array( '#showtopic=(.+?)(\#|&|$)#i', 'topic/$1/$2' ),
'in' => array( 'regex' => '#^/topic/(\d+?)(/|$)#i',
'matches' => array( array( 'showtopic', '$1' ) ) ) ),

'acteqst' => array( 'app' => 'forums',
'allowRedirect' => 1,
'out' => array( '#act=ST(.*?)&t=(.+?)(&|$)#i', 'topic/$2/$3' ),
'in' => array( 'regex' => '#^notavalidrequest$#i',
'matches' => array( array( 'showtopic', '0' ) ) ) ),

'act=idx' => array( 'app' => 'forums',
'allowRedirect' => 0,
'out' => array( '#act=idx(&|$)#i', 'index$1' ),
'in' => array( 'regex' => '#^/index(/|$|\?)#i',
'matches' => array( array( 'act', 'idx' ) ) ) ),
);

打开admin/applications/members/extensions/furlTemplates.php
修改后的
代码:
$_SEOTEMPLATES = array(	'showuser'	=> array( 'app' => 'members', 'allowRedirect' => 1, 'out' => array( '#showuser=(.+?)((?:&|&)f=(.+?))?(&|$)#i', 'user/$1/$2$4' ), 'in' => array( 'regex' => "#^/user/(\d+?)(/|$)#i", 'matches' => array( array( 'showuser', '$1' ) ) ) ),	'members_status_single' => array( 'app' => 'members', 'allowRedirect' => 0, 'out' => array( '#app=members(?:&|&)module=profile(?:&|&)section=status(?:&|&)type=single(&|$)#i', 'statuses/user/$1' ), 'in' => array( 'regex' => "#^/statuses/user/([^/]+?)\#\{__varBlock__\}status_id#i", 'matches' => array( array( 'app' , 'members' ),	array( 'section', 'status' ),	array( 'module' , 'profile' ),	array( 'type' , 'single' ) ) ) ),	'members_status_member_all'	=> array( 'app' => 'members', 'allowRedirect' => 0, 'out' => array( '#app=members(?:&|&)module=profile(?:&|&)section=status(?:&|&)type=memberall(?:&|&)member_id=\d+?(&|$)#i', 'statuses/user/$1' ), 'in' => array( 'regex' => "#^/statuses/user/(\d+?)-([^/]+?)/(?!\#\{__varBlock__\}status_id)#i",	'matches' => array( array( 'app' , 'members' ),	array( 'section' , 'status' ),	array( 'module' , 'profile' ),	array( 'member_id' , '$1' ) ) ) ),	'members_status_friends'=> array( 'app' => 'members', 'allowRedirect' => 0, 'out' => array( '#app=members(?:&|&)module=profile(?:&|&)section=status(?:&|&)type=friends(&|$)#i', 'statuses/friends/$2' ), 'in' => array( 'regex' => "#^/statuses/friends#i", 'matches' => array( array( 'app' , 'members' ),	array( 'section', 'status' ),	array( 'module' , 'profile' ),	array( 'type' , 'friends' ) ) ) ),	'members_status_all'	=> array( 'app' => 'members', 'allowRedirect' => 0, 'out' => array( '#app=members(?:&|&)module=profile(?:&|&)section=status((?:&|&)type=all)?(&|$)#i', 'statuses/all/$2' ), 'in' => array( 'regex' => "#^/statuses/all#i", 'matches' => array( array( 'app' , 'members' ),	array( 'section', 'status' ),	array( 'module' , 'profile' ) ) ) ),	'members_list' => array(	'app'	=> 'members',	'allowRedirect' => 0,	'out'	=> array( '#app=members((&|&)module=list)?#i', 'members/' ),	'in'	=> array(	'regex'	=> "#^/members(/|$|\?)#i",	'matches'	=> array( array( 'app', 'members' ), array( 'module', 'list' ) )	)	),	'most_liked' => array(	'app'	=> 'members',	'allowRedirect' => 0,	'out'	=> array( '#app=members(?:&|&)module=reputation(?:&|&)section=most#i', 'best-content/' ),	'in'	=> array(	'regex'	=> "#^/best-content(/|$|\?)#i",	'matches'	=> array( array( 'app', 'members' ), array( 'module', 'reputation' ), array( 'section', 'most' ) )	)	),
);
 
  • 支持
反馈: RaySajuuk
Xiao.T

Xiao.T

管理员
技术员
2008-05-19
6,008
6,531
哈哈也适用于博客等哦
 

漂亮的石头

ZIY IPB 志愿者
2012-11-26
5
0
中文搜索引擎 测试下~ :)
 
X

xinli_zhao

普通会员
2009-07-09
28
6
肯定是精简后收录效果好
我个人感觉
如果不改的话,BAIDU的快照链接是乱码
 
R

RaySajuuk

Ziy VIP
2009-12-26
30
3
呃 收下...等有空了做IPB看
 
A

adam820616

普通会员
2009-03-21
4
4
按楼主的方法修改
并且设置了Use .htaccess mod_rewrite
但是好像还是没有效果呢,是不是要更新缓存?
 
Xiao.T

Xiao.T

管理员
技术员
2008-05-19
6,008
6,531
按楼主的方法修改
并且设置了Use .htaccess mod_rewrite
但是好像还是没有效果呢,是不是要更新缓存?
你要在后台重新更新URL规则
 

ZIY 会员微信群