$tnamerule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule = preg_replace("/^(.*)\//", '', $tnamerule);
$plist = preg_replace("/PageNo=(\d+)/i",str_replace("{page}","\\1",$tnamerule),$plist);
打开 /include/helpers/channelunit.helper.php 找到
global $cfg_typedir_df;
改成
global $cfg_typedir_df, $cfg_rewrite;
继续找到$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
改成if($cfg_rewrite == 'Y')
{
$reurl = $typedir.'/';
}
else
{
//动态
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
}
继续找到
return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html';
改成
$articleDir = MfTypedir($typedir);
$articleRule = strtolower($namerule);
if($articleRule=='')
{
$articleRule = strtolower($GLOBALS['cfg_df_namerule']);
}
if($typedir=='')
{
$articleDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
}
$dtime = GetDateMk($timetag);
list($y, $m, $d) = explode('-', $dtime);
$arr_rpsource = array('{typedir}','{y}','{m}','{d}','{timestamp}','{aid}','{cc}');
$arr_rpvalues = array($articleDir,$y, $m, $d, $timetag, $aid, dd2char($m.$d.$aid.$y));
if($filename != '')
{
$articleRule = dirname($articleRule).'/'.$filename.$GLOBALS['cfg_df_ext'];
}
$articleRule = str_replace($arr_rpsource,$arr_rpvalues,$articleRule);
if(preg_match("/\{p/", $articleRule))
{
$articleRule = str_replace('{pinyin}',GetPinyin($title).'_'.$aid,$articleRule);
$articleRule = str_replace('{py}',GetPinyin($title,1).'_'.$aid,$articleRule);
}
$articleUrl = '/'.preg_replace("/^\//", '', $articleRule);
if(preg_match("/index\.html/", $articleUrl) && $cfg_arc_dirname=='Y')
{
$articleUrl = str_replace('index.html', '', $articleUrl);
}
return $articleUrl;
2、内容文章分页伪静态
打开 /include/arc.archives.class.php 找到
$PageList = preg_replace("#.php\?aid=(\d+)#i", '-\\1-1.html', $PageList);
有2处,改成
$PageList = preg_replace("#view.php\?aid=(\d+)#i", '\\1.html', $PageList);
继续找到
$PageList = str_replace(".php?aid=", "-", $PageList);
有3处,改成
$PageList = str_replace("view.php?aid=", "", $PageList);
继续找到
$PageList = preg_replace("#&pageno=(\d+)#i", '-\\1.html', $PageList);
有3处,改成
$PageList = preg_replace("#&pageno=(\d+)#i", '_\\1.html', $PageList);
3、TAG标签伪静态链接
打开 /include/taglib/tag.lib.php 找到
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
改成
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";
4、TAG标签分页伪静态链接
打开 /include/arc.taglist.class.php 找到
$this->PageNo = $GLOBALS['PageNo'];
在它的下面加入
if($this->PageNo == 0)
{
$this->PageNo = 1;
}
继续找到
$prepage="";
在它的上面加入
global $cfg_rewrite;
继续找到
$purl .= "?/".urlencode($this->Tag);
改成
if($cfg_rewrite == 'Y')
{
$purl = "/tags/".urlencode($this->Tag);
}
else
{
$purl .= "?/".urlencode($this->Tag);
}
5、搜索页伪静态链接
打开 /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);
打开 /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",'-\\1.html',$plist);
}
return $plist;
还需要在你电脑站模板里把搜索框代码改成静态的js提交搜索,参考下面代码
<script type="text/javascript">
function search()
{
var q = document.getElementById("q").value;
window.location.href = ""+q+".html";
}
function enterIn(obj,evt)
{
var evt = evt ? evt : (window.event ? window.event : null);
if (evt.keyCode == 13)
{
var q = obj.value;
window.location.href = ""+q+".html";
}
}
</script>
<form action="" method="post" onsubmit="return false">
<div class="form">
<h4>搜索</h4>
<input name="q" id="q" onkeydown="enterIn(this,event);" type="text" />
<button type="submit" class="search-submit" onclick="search()">搜索</button>
</div>
</form>