1、打开 /plus/search.php 找到
$mid = (isset($mid) && is_numeric($mid)) ? $mid : 0;
在它下面加入:
if ( $mobile==1 ) { define('DEDEMOB', 'Y'); }
继续找到
$t1 = ExecTime();
在它下面加入
$keyword = preg_replace("/-(d+)/i",'',$keyword); $oldkeyword = preg_replace("/-(d+)/i",'',$oldkeyword);
2、打开 /include/arc.searchview.class.php 搜索
global $oldkeyword;
修改为
global $oldkeyword, $cfg_rewrite;
继续找到
$purl .= "?".$geturl;
修改为
if($cfg_rewrite != 'Y' && !defined('DEDEMOB')) { $purl .= "?".$geturl; } else { $purl = '/search/'.urlencode($oldkeyword); }
return $plist;
修改为
if($cfg_rewrite == 'Y') { $plist = preg_replace("/PageNo=(d+)/i",'-.html',$plist); } return $plist;
Nginx伪静态规则为例,规则如下:
rewrite ^/search/(.*)-([0-9]+).html$ /plus/search.php?q=$1&PageNo=$2&pagesize=10&searchtype=title; rewrite ^/search/(.*).html$ /plus/search.php?q=$1&pagesize=10&searchtype=title;
评论前必须登录!
立即登录 注册