本帖最后由 rikioy 于 2011-11-28 09:38 编辑
由于实现伪静态需要修改dx代码。所以这里放出一个hack方法。供站长测试。就内置到房产之中了。请站长自行扩展与测试
- function_admincp.php rewritedata 函数加入相关
- if(in_array('forum_archiver', $_G['setting']['rewritestatus'])) {
- $data['search']['forum_archiver'] = "/<a href\="\?(fid|tid)\-(\d+)\.html(&page\=(\d+))?"([^\>]*)\>/e";
- $data['replace']['forum_archiver'] = "rewriteoutput('forum_archiver', 0, '\\1', '\\2', '\\4', '\\5')";
- }
- 后面加入
- if(in_array('newhouse_view', $_G['setting']['rewritestatus'])) {
- $data['search']['newhouse_view'] = "/<a href\="house.php\?mod\=viewhouse&(amp;)?ac\=info&(amp;)?tid=(\d+)?"([^\>]*)\>/e";
- $data['replace']['newhouse_view'] = "rewriteoutput('newhouse_view', 0, '\\3')";
- }
复制代码- $data['rulesearch']['forum_archiver'] = '{action}-{value}.html';
- $data['rulereplace']['forum_archiver'] = 'index.php?action={action}&value={value}';
- $data['rulevars']['forum_archiver']['{action}'] = '(fid|tid)';
- $data['rulevars']['forum_archiver']['{value}'] = '([0-9]+)';
- 后面加入
- $data['rulesearch']['newhouse_view'] = 'newhouse-{hid}.html';//house
- $data['rulereplace']['newhouse_view'] = 'house.php?mod=viewhouse&ac=info&tid={hid}';//house
- $data['rulevars']['newhouse_view']['{hid}'] = '([0-9]+)';//house
复制代码- function_core.php 中 rewriteoutput 函数改造elseif($type == 'forum_archiver') {
- list(,, $action, $value, $page, $extra) = func_get_args();
- $host = '';
- $r = array(
- '{action}' => $action,
- '{value}' => $value,
- );
- if($page) {
- $fextra = '?page='.$page;
- }
- }
- 后加入
- elseif($type == 'newhouse_view') {
- list(,,$hid) = func_get_args();
- $host = '';
- $r = array(
- '{hid}' => $hid,
- );
- }
复制代码- lang_admincp.php 中 'setting_seo_rewritestatus_forum_archiver' => '论坛 Archiver 页',
- 后面加入
- 'setting_seo_rewritestatus_newhouse_view' => '楼盘浏览页',
复制代码
apache rewrite规则中加入
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^newhouse-([0-9]+)\.html$ house.php?mod=viewhouse&ac=info&tid=$1&%1
|