最新織夢(mèng)DEDECMS全站目錄化偽靜態(tài)設(shè)置(網(wǎng)址和生成靜態(tài)地址一樣、電腦和手機(jī)訪問(wèn)地址也一樣)
最新織夢(mèng)DEDECMS全站目錄化偽靜態(tài)設(shè)置,偽靜態(tài)設(shè)置成功后,網(wǎng)址和生成靜態(tài)地址一樣、電腦和手機(jī)訪問(wèn)地址也一樣。
如果你電腦端是生成靜態(tài)而手機(jī)端是動(dòng)態(tài)的話,請(qǐng)查看織夢(mèng)手機(jī)端偽靜態(tài)設(shè)置http://www.vanhostingweb.com/1157.html
此教程適合文章命名選擇的是{aid},如果你的文章命名選擇的是{pinying},請(qǐng)看織夢(mèng)DEDECMS全站偽靜態(tài)(電腦+手機(jī)移動(dòng)){pinyin}拼音版http://www.vanhostingweb.com/2506.html
偽靜態(tài)設(shè)置成功后,訪問(wèn)URL地址效果如下。
電腦端的URL地址:
列表頁(yè)? http://www.123.com/news/
列表分頁(yè) http://www.123.com/news/list_1_2.html
內(nèi)容頁(yè)??? http://www.123.com/xinwenzixun/6.html
內(nèi)容頁(yè)分頁(yè)? http://www.123.com/news/6_2.html
TAG標(biāo)簽頁(yè)? http://www.123.com/tags/職場(chǎng)/
TAG標(biāo)簽分頁(yè) http://www.123.com/tags/職場(chǎng)/2/
搜索頁(yè)??? http://www.123.com/search/職場(chǎng).html
搜索頁(yè)分頁(yè)? http://www.123.com/search/職場(chǎng)-2.html
手機(jī)端的URL地址:
列表頁(yè)?? ? ? ?http://m.123.com/news/
列表分頁(yè)? ? ? ?http://m.123.com/news/list_1_2.html
內(nèi)容頁(yè)??? http://m.123.com/news/6.html
內(nèi)容頁(yè)分頁(yè)? http://m.123.com/xinwenzixun/6_2.html
TAG標(biāo)簽頁(yè)? http://m.123.com/tags/職場(chǎng)/
TAG標(biāo)簽分頁(yè) http://m.123.com/tags/職場(chǎng)/2/
搜索頁(yè)??? http://m.123.com/search/職場(chǎng).html
搜索頁(yè)分頁(yè)? http://m.123.com/search/職場(chǎng)-2.htm
是不是心動(dòng)了呢,那我們開(kāi)始動(dòng)手設(shè)置吧。
準(zhǔn)備工作:先備份好網(wǎng)站數(shù)據(jù),網(wǎng)站需要修改的文件我已打包好,都是從官網(wǎng)上直接下載,然后修改的,你可根據(jù)自己網(wǎng)站編碼下載,然后覆蓋以前的文件即可。把你的移動(dòng)域名解析到網(wǎng)站并綁定網(wǎng)站根目錄下的m文件夾。
GBK
UTF8
如果你想自己修改文件,上面的下載請(qǐng)忽略,然后查看下面的修改教程。
網(wǎng)站后臺(tái)設(shè)置:
一、后臺(tái)-系統(tǒng)參數(shù)-核心設(shè)置-開(kāi)啟偽靜態(tài)
核心設(shè)置里面,啟用絕對(duì)網(wǎng)址關(guān)閉
二、安裝全站動(dòng)靜態(tài)插件,下載的壓縮包里有。設(shè)置全站為動(dòng)態(tài)。
三、后臺(tái)添加兩個(gè)新變量:(注意:如果你的網(wǎng)站模板是自適應(yīng)的,沒(méi)有手機(jī)站,此步可以跳過(guò))
變量名稱:cfg_mobile
變量類型:文本
參數(shù)說(shuō)明:手機(jī)版網(wǎng)址
變量值:http://m.verywen.com
所屬組:站點(diǎn)設(shè)置
變量名稱:cfg_rewritem
變量類型:布爾(Y/N)
參數(shù)說(shuō)明:手機(jī)版?zhèn)戊o態(tài)
變量值:Y
所屬組:站點(diǎn)設(shè)置
四、修改文件
1、列表頁(yè)和內(nèi)容頁(yè)偽靜態(tài)鏈接
打開(kāi) /plus/list.php 搜索
$tid = (isset($tid) && is_numeric($tid) ? $tid : 0);
修改為
if($cfg_rewrite == 'Y')
{
if(!is_numeric($tid))
{
$typedir = parse_url($tid, PHP_URL_PATH);
$PageNo = stripos(GetCurUrl(), '.html') ? intval(str_replace('.html', '', end(explode("_", GetCurUrl())))) : 1;
$tinfos = $dsql->GetOne("SELECT * FROM `#@__arctype` WHERE typedir='/$typedir' or typedir='{cmspath}/$typedir'");
if(is_array($tinfos))
{
$tid = $tinfos['id'];
$typeid = GetSonIds($tid);
$row = $dsql->GetOne("Select count(id) as total From `#@__archives` where typeid in({$typeid})");
}
else
{
$tid = 0;
}
}
}
else
{
$tid = (isset($tid) && is_numeric($tid) ? $tid : 0);
}
打開(kāi) /plus/view.php 搜索
$t1 = ExecTime();
在它下面加入
if($cfg_rewrite == 'Y')
{
if(!is_numeric($aid))
{
$aid = stripos(GetCurUrl(), '.html') ? str_replace('.html', '', end(explode("/", GetCurUrl()))) : 0;
$aidpage = explode("_",$aid);
$aid = intval($aidpage[0]);
$pageno = intval($aidpage[1]);
}
$arcrow = GetOneArchive($aid);
if ($arcrow['arcurl'] != GetCurUrl()) die(" Request Error! ");
}
上面代碼里,如果打開(kāi)的內(nèi)容頁(yè)地址不是實(shí)際地址的話,頁(yè)面會(huì)直接顯示Request Error!
? 如果你想讓它顯示404頁(yè)面
可用下面代碼
if($cfg_rewrite == 'Y')
{
if(!is_numeric($aid))
{
$aid = stripos(GetCurUrl(), '.html') ? str_replace('.html', '', end(explode("/", GetCurUrl()))) : 0;
$aidpage = explode("_",$aid);
$aid = intval($aidpage[0]);
$pageno = intval($aidpage[1]);
}
$arcrow = GetOneArchive($aid);
if ($arcrow['arcurl'] != GetCurUrl())
{
header("location:/404.html");
die ();
}
}
打開(kāi) /include/arc.listview.class.php 搜索
//獲得上一頁(yè)和下一頁(yè)的鏈接
在它上面加入
if($cfg_rewrite == 'Y')
{
$purl = "";
}
else
{
$geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&";
$purl .= '?'.$geturl;
}
繼續(xù)搜索
$plist = str_replace('.php?tid=', '-', $plist);
在它上面加上
$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);
打開(kāi) /include/helpers/channelunit.helper.php 搜索
global $cfg_typedir_df;
修改為
global $cfg_typedir_df, $cfg_rewrite;
繼續(xù)搜索
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
修改為
if($cfg_rewrite == 'Y')
{
$reurl = $typedir.'/';
}
else
{
//動(dòng)態(tài)
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
}
繼續(xù)搜索
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}','048jcw27883r','{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、內(nèi)容文章分頁(yè)偽靜態(tài)
打開(kāi) /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);
繼續(xù)搜索
$PageList = str_replace(".php?aid=", "-", $PageList);
有3處,修改為
$PageList = str_replace("view.php?aid=", "", $PageList);
繼續(xù)搜索
$PageList = preg_replace("#&pageno=(\d+)#i", '-\\1.html', $PageList);
有3處,修改為
$PageList = preg_replace("#&pageno=(\d+)#i", '_\\1.html', $PageList);
3、TAG標(biāo)簽偽靜態(tài)鏈接
打開(kāi) /include/taglib/tag.lib.php 搜索
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
修改為
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";
4、TAG標(biāo)簽分頁(yè)偽靜態(tài)鏈接
打開(kāi) /include/arc.taglist.class.php 搜索
$this->PageNo = $GLOBALS['PageNo'];
在它下面加入
if($this->PageNo == 0)
{
$this->PageNo = 1;
}
繼續(xù)搜索
$prepage="";
在它上面加入
global $cfg_rewrite;
繼續(xù)搜索
$purl .= "?/".urlencode($this->Tag);
修改為
if($cfg_rewrite == 'Y')
{
$purl = "/tags/".urlencode($this->Tag);
}
else
{
$purl .= "?/".urlencode($this->Tag);
}
5、搜索頁(yè)偽靜態(tài)鏈接
打開(kāi) /plus/search.php 搜索
$mid = (isset($mid) && is_numeric($mid)) ? $mid : 0;
在它下面加入
if ( $mobile==1 )
{
define('DEDEMOB', 'Y');
}
繼續(xù)搜索
$t1 = ExecTime();
在它下面加入
$keyword = preg_replace("/-(\d+)/i",'',$keyword);
$oldkeyword = preg_replace("/-(\d+)/i",'',$oldkeyword);
打開(kāi) /include/arc.searchview.class.php 搜索
global $oldkeyword;
修改為
global $oldkeyword, $cfg_rewrite;
繼續(xù)搜索
$purl .= "?".$geturl;
修改為
if($cfg_rewrite != 'Y' && !defined('DEDEMOB'))
{
$purl .= "?".$geturl;
}
else
{
$purl = '/search/'.urlencode($oldkeyword);
}
繼續(xù)搜索
return $plist;
修改為
if($cfg_rewrite == 'Y')
{
$plist = preg_replace("/PageNo=(\d+)/i",'-\\1.html',$plist);
}
return $plist;
6、移動(dòng)版當(dāng)前位置 {dede:field.position/} 標(biāo)簽動(dòng)態(tài)改成偽靜態(tài)
打開(kāi) /include/typelink.class.php 搜索
$indexpage = "<a href='index.php'>".$this->indexName."</a>";
修改成
if($GLOBALS['cfg_rewritem'] == 'Y')
{
$indexpage = "<a href='".$GLOBALS['cfg_mobile']."'>".$this->indexName."</a>";
}
else
{
$indexpage = "<a href='index.php'>".$this->indexName."</a>";
}
繼續(xù)搜索
return 'list.php?tid='.$typeinfos['id'];
修改成
if($GLOBALS['cfg_rewritem'] == 'Y')
{
return GetTypeUrl($typeinfos['id'],MfTypedir($typeinfos['typedir']),$typeinfos['isdefault'],$typeinfos['defaultname'],$typeinfos['ispart'],$typeinfos['namerule2'],$typeinfos['moresite'],$typeinfos['siteurl'],$typeinfos['sitepath']);
}
else
{
return 'list.php?tid='.$typeinfos['id'];
}
7、模板里把搜索框代碼改成靜態(tài)的js提交搜索,參考下面代碼,注意標(biāo)紅的地方
電腦端
<script type="text/javascript">
function search()
{
var q = document.getElementById("q").value;
window.location.href = "http://www.441516.com/search/"+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 = "http://www.441516.com/search/"+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>
標(biāo)紅的部分查看下圖。
手機(jī)端
<script type="text/javascript">
function search()
{
var q = document.getElementById("q").value;
window.location.href = "http://m.441516.com/search/"+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 = "http://m.441516.com/search/"+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>
五、織夢(mèng)電腦版及手機(jī)版的偽靜態(tài)規(guī)則下載,根據(jù)你的運(yùn)行環(huán)境選擇相應(yīng)的規(guī)則。
本地下載
六、織夢(mèng)手機(jī)站織夢(mèng)偽靜態(tài)規(guī)則-固定自由版m目錄文件替換文件,解壓后,替換根目錄下的m文件夾即可。
本地下載
七、電腦端模板添加跳轉(zhuǎn)代碼:
主頁(yè)
<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobile/}">
<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
列表頁(yè)
<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobile/}{dede:type}[field:typeurl/]{/dede:type}">
<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}{dede:type}[field:typeurl/]{/dede:type}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
內(nèi)容頁(yè)
<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobile/}{dede:field.id runphp=yes}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}">
<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}{dede:field.id runphp=yes}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
測(cè)試看看偽靜態(tài)現(xiàn)在正常了么。
壓縮包里面的手機(jī)模板都是默認(rèn)的手機(jī)模板,如果出現(xiàn)樣式問(wèn)題或者是數(shù)據(jù)調(diào)用不出來(lái)。你可以按照下面的方法修改你的手機(jī)模板
css、js、images 改成絕對(duì)路徑,例如 assets/css/?改成?/assets/css/
index.php?改成?{dede:global.cfg_mobile/}
list.php?tid=[field:id/]?改成?[field:typelink/]
list.php?tid=~id~?改成?~typelink~
list.php?tid={dede:field name='id'/}?改成?{dede:field.typeurl/}
view.php?aid=[field:id/]?改成?[field:arcurl/]
[field:litpic/]?改成?[field:global.cfg_basehost/][field:litpic/]
[field:image/]?改成?<img src="[field:global.cfg_basehost/][field:litpic/]">
上一頁(yè)標(biāo)簽 {dede:prenext get='pre'/}
改成
{dede:prenext get=pre runphp=yes}
$preurl = @me;
preg_match('/aid=(d*)/',$preurl,$match);
$result = GetOneArchive($match[1]);
@me = !empty($result) ? "上一篇:<a href="/m{$result['arcurl']}">{$result['title']}</a>" : "上一篇:沒(méi)有了";
{/dede:prenext}
下一頁(yè)標(biāo)簽?{dede:prenext get='next'/}
改成
{dede:prenext get=next runphp=yes}
$preurl = @me;
preg_match('/aid=(d*)/',$preurl,$match);
$result = GetOneArchive($match[1]);
@me = !empty($result) ? "下一篇:<a href="/m{$result['arcurl']}">{$result['title']}</a>" : "下一篇:沒(méi)有了";
{/dede:prenext}
文章內(nèi)容?{dede:field.body/}改成
{dede:field.body runphp=yes}
global $cfg_basehost;
$str = @me;
$search = '/(<img.*?)width=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';
$search1 = '/(<img.*?)height=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';
$search2 = '#(<img.*?style=".*?)width:\d+px;([^"]*?.*?>)#i';
$search3 = '#(<img.*?style=".*?)height:\d+px;([^"]*?.*?>)#i';
$content = preg_replace($search,'$1$3',$str);
$content = preg_replace($search1,'$1$3',$content);
$content = preg_replace($search2,'$1$2',$content);
$content = preg_replace($search3,'$1$2',$content);
@me = $content;
@me = str_replace('/uploads/allimg/', $cfg_basehost.'/uploads/allimg/', $content);
{/dede:field.body}
欄目?jī)?nèi)容?{dede:field.content/}
改成
{dede:field.content runphp=yes}
global $cfg_basehost;
$str = @me;
$search = '/(<img.*?)width=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';
$search1 = '/(<img.*?)height=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is';
$search2 = '#(<img.*?style=".*?)width:\d+px;([^"]*?.*?>)#i';
$search3 = '#(<img.*?style=".*?)height:\d+px;([^"]*?.*?>)#i';
$content = preg_replace($search,'$1$3',$str);
$content = preg_replace($search1,'$1$3',$content);
$content = preg_replace($search2,'$1$2',$content);
$content = preg_replace($search3,'$1$2',$content);
@me = $content;
@me = str_replace('/uploads/allimg/', $cfg_basehost.'/uploads/allimg/', $content);
{/dede:field.content}
好了,完成了,有問(wèn)題請(qǐng)留言。如果偽靜態(tài)不正常,請(qǐng)繼續(xù)看下面,如果正常。下面就不用看了。
還有一個(gè)要注意,偽靜態(tài)后,訪問(wèn)后臺(tái)管理地址后面要加上index.php
最后給幾個(gè)演示地址:
補(bǔ)充:
上面的偽靜態(tài)是在IIS下?tīng)顟B(tài)全部是正常的,但在NGINX下tags就顯示404錯(cuò)誤了。由于對(duì)正規(guī)則不太了解,網(wǎng)上查了好多教程,終于搞定,列表頁(yè),分頁(yè)后面都帶.html,上面教程里面不帶.html
地址如下:
- TAG標(biāo)簽頁(yè) http://www.verywen.com/tags/2012/
- TAG標(biāo)簽分頁(yè) http://www.verywen.com/tags/2012/2/
這個(gè)在IIS運(yùn)行環(huán)境下是顯示正常的。但在NGINX下除TAG首頁(yè)外,里面的鏈接都打不開(kāi)的。
修改后的地址如下:
- TAG標(biāo)簽頁(yè) http://www.verywen.com/tags/2012.html
- TAG標(biāo)簽分頁(yè) http://www.verywen.com/tags/2012/2.html
修改方法:打開(kāi) \include\taglib\tag.lib.php ,大約在87行。
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
修改成:
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword']).".html";
打開(kāi)?\include\arc.taglist.class.php,大約在508行,要在地址后面加上.html
?分頁(yè)中間數(shù)字鏈接地址:
搜索:
$listdd.="<li><a href='".$purl."/$j/'>".$j."</a></li>\r\n";
替換成:
$listdd.="<li><a href='".$purl."/$j.html'>".$j."</a></li>\r\n";
?分頁(yè)首頁(yè)鏈接地址:
搜索:
$indexpage="<li><a href='".$purl."/1/'>首頁(yè)</a></li>\r\n";
替換成:
$indexpage="<li><a href='".$purl."/1.html'>首頁(yè)</a></li>\r\n";
分頁(yè)上一頁(yè)鏈接地址:
搜索:
$prepage.="<li><a href='".$purl."/$prepagenum/'>上一頁(yè)</a></li>\r\n";
替換成:
$prepage.="<li><a href='".$purl."/$prepagenum.html'>上一頁(yè)</a></li>\r\n";
?分頁(yè)下一頁(yè)鏈接地址:
搜索:
$nextpage.="<li><a href='".$purl."/$nextpagenum/'>下一頁(yè)</a></li>\r\n";
替換成:
$nextpage.="<li><a href='".$purl."/$nextpagenum.html'>下一頁(yè)</a></li>\r\n";
?未頁(yè)鏈接地址:
搜索:
$endpage="<li><a href='".$purl."/$totalpage/'>末頁(yè)</a></li>\r\n";
替換成:
$endpage="<li><a href='".$purl."/$totalpage.html'>末頁(yè)</a></li>\r\n";
如果你嫌上面一個(gè)一個(gè)的修改太麻煩,下面這個(gè)是關(guān)于除數(shù)字鏈接外其他分頁(yè)鏈接修改過(guò)的源碼,也就是
//獲得上一頁(yè)和下一頁(yè)的鏈接和//獲得數(shù)字鏈接之前的全部代碼。
//獲得上一頁(yè)和下一頁(yè)的鏈接
if($this->PageNo != 1)
{
$prepage.="<li><a href='".$purl."/$prepagenum.html'>上一頁(yè)</a></li>\r\n";
$indexpage="<li><a href='".$purl."/1.html'>首頁(yè)</a></li>\r\n";
}
else
{
$indexpage="<li><a>首頁(yè)</a></li>\r\n";
}
if($this->PageNo!=$totalpage && $totalpage>1)
{
$nextpage.="<li><a href='".$purl."/$nextpagenum.html'>下一頁(yè)</a></li>\r\n";
$endpage="<li><a href='".$purl."/$totalpage.html'>末頁(yè)</a></li>\r\n";
}
else
{
$endpage="<li><a>末頁(yè)</a></li>\r\n";
}
//獲得數(shù)字鏈接
TAG偽靜態(tài)規(guī)則如下
rewrite ^(.*)/tags\.html $1/tags.php;
rewrite ^(.*)/tags/(.*).html $1/tags.php?/$2;
rewrite ^(.*)/tags/(.*)\/([0-9])(?:(\?.*))\.html* $1/tags.php?\/$1\/$2;
以上基本就完成了。但有一個(gè)問(wèn)題。就是在網(wǎng)站根目錄下仍會(huì)自動(dòng)生成空的欄目文件夾。解決方法請(qǐng)?jiān)L問(wèn)下面鏈接
織夢(mèng)DEDECMS欄目在動(dòng)態(tài)或者偽靜態(tài)下仍然自動(dòng)生成空的欄目文件夾的解決方法
收集的TGA偽靜態(tài)規(guī)則
#TAG標(biāo)簽
rewrite ^/tags\.html$ /tags.php;
rewrite ^/tags/(.*)(?:(\?.*))* /tags.php\?\/$1;
rewrite ^/tags/(.*)\/(?:(\?.*))* /tags.php\?\/$1\/;
rewrite ^/tags/(.*)\/([0-9])(?:(\?.*))* /tags.php\?\/$1\/$2;
rewrite ^/tags/(.*)\/([0-9])\/(?:(\?.*))* /tags.php\?\/$1\/$2\/;
1.本站主要是為了記錄工作、學(xué)習(xí)中遇到的問(wèn)題,可能由于本人技術(shù)有限,內(nèi)容難免有紕漏,一切內(nèi)容僅供參考。
2.本站部分內(nèi)容來(lái)源互聯(lián)網(wǎng),如果有圖片或者內(nèi)容侵犯您的權(quán)益請(qǐng)聯(lián)系我們刪除!
3.本站所有原創(chuàng)作品,包括文字、資料、圖片、網(wǎng)頁(yè)格式,轉(zhuǎn)載時(shí)請(qǐng)標(biāo)注作者與來(lái)源。