-
人力資源管理類網(wǎng)站織夢...
-
中英雙語律師事務(wù)所類網(wǎng)...
-
財稅記賬工商注冊認(rèn)證類...
-
裝飾建材公司類網(wǎng)站織夢...
-
儀器分析儀類網(wǎng)站織夢模...
-
營銷型無縫鋼管定制生產(chǎn)...
-
精工機械軸承生產(chǎn)廠家類...
-
展覽展會信息類網(wǎng)站織夢...
-
電腦系統(tǒng)軟件下載類網(wǎng)站...
-
儀器儀表科技公司類網(wǎng)站...
-
手游APP軟件下載類網(wǎng)站織...
-
鋼結(jié)構(gòu)崗?fù)I銷型織夢網(wǎng)...
-
食品百貨英文外貿(mào)類網(wǎng)站...
-
蔬菜鮮果配送類網(wǎng)站織夢...
-
水利工程施工類網(wǎng)站織夢...
-
貂絨大衣服裝設(shè)計類網(wǎng)站...
-
網(wǎng)站模板資源下載類網(wǎng)站...
-
電子元件電路板類網(wǎng)站織...
-
物流快運速遞類網(wǎng)站織夢...
-
玩具動漫類網(wǎng)站織夢模板...
請確保你網(wǎng)站所在的主機或者服務(wù)器支持偽靜態(tài)并且已經(jīng)開啟了偽靜態(tài)功能
本教程只適合給那些需要電腦版和手機版都想要偽靜態(tài)的小伙伴使用!
開啟成功后,登錄后臺時,必須在地址欄補加上index.php
本教程只適合給那些需要電腦版和手機版都想要偽靜態(tài)的小伙伴使用!
開啟成功后,登錄后臺時,必須在地址欄補加上index.php

后臺登錄不想加index.php或者某個文件夾想排除的小伙伴可以在欄目列表偽靜態(tài)規(guī)則前面加個排除目錄,添加后目錄不使用偽靜態(tài)
apache
#排除RewriteRule ^(dede|m|admin)($|/)$ /$1/index.php [L]
nginx
rewrite ^/(dede|m|admin)($|/) /$1/index.php last;
iis7 / iis8
<rule name="織夢iis排除目錄" stopProcessing="true"><match ignoreCase="false" url="^(dede|m|admin)($|/)$"/><action type="Rewrite" url="/{R:1}/index.php"/></rule>
dede|m|admin 這3個目錄不使用偽靜態(tài)
如圖




設(shè)置偽靜態(tài)后,你的電腦站url會像如下:
- 產(chǎn)品列表頁 http://www.j4240.cn/free/
- 產(chǎn)品列表分頁 http://www.j4240.cn/free/list_2_2.html
- 新聞列表頁 http://www.j4240.cn/dedecms/
- 新聞列表分頁 http://www.j4240.cn/dedecms/list_3_2.html
- 內(nèi)容頁 http://www.j4240.cn/free/92.html
- 內(nèi)容頁分頁 http://www.j4240.cn/free/92_2.html
- TAG標(biāo)簽頁 http://www.j4240.cn/tags/織夢/
- TAG標(biāo)簽分頁 http://www.j4240.cn/tags/織夢/2/
- 搜索頁 http://www.j4240.cn/search/織夢.html
- 搜索頁分頁 http://www.j4240.cn/search/織夢-2.html
設(shè)置偽靜態(tài)后,你的手機站url會像如下:
- 產(chǎn)品列表頁 http://m.91084.com/free/
- 產(chǎn)品列表分頁 http://m.91084.com/free/list_2_2.html
- 新聞列表頁 http://m.91084.com/dedecms/
- 新聞列表分頁 http://m.91084.com/dedecms/list_3_2.html
- 內(nèi)容頁 http://m.91084.com/free/92.html
- 內(nèi)容頁分頁 http://m.91084.com/free/92_2.html
- TAG標(biāo)簽頁 http://m.91084.com/tags/織夢/
- TAG標(biāo)簽分頁 http://m.91084.com/tags/織夢/2/
- 搜索頁 http://m.91084.com/search/織夢.html
- 搜索頁分頁 http://m.91084.com/search/織夢-2.html
網(wǎng)站后臺開啟偽靜態(tài)選項

網(wǎng)站后臺取消絕對路徑
后臺-核心設(shè)置-啟用絕對網(wǎng)址 改成 【否】,不用擔(dān)心手機站圖片問題,下面手機站偽靜態(tài)教程里有辦法
網(wǎng)站后臺設(shè)置整站為動態(tài)
- 電腦站偽靜態(tài)教程開始
1、列表頁和內(nèi)容頁偽靜態(tà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 `dede_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 `dede_archives` where arcrank>-1 and typeid in({$typeid})");}else{$tid = 0;}}}else{$tid = (isset($tid) && is_numeric($tid) ? $tid : 0);}
打開 /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]);}}
打開 /include/arc.listview.class.php 找到
//獲得上一頁和下一頁的鏈接
在它的上面加入
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);
打開 /include/helpers/channelunit.helper.php 找到
global $cfg_typedir_df;
改成
繼續(xù)找到global $cfg_typedir_df, $cfg_rewrite;
改成$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
if($cfg_rewrite == 'Y'){$reurl = $typedir.'/';}else{//動態(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}','wk9bvxspwpet','{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)容文章分頁偽靜態(tà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)鏈接
打開 /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)簽分頁偽靜態(tà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、搜索頁偽靜態(tà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);
打開 /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;
還需要在你電腦站模板里把搜索框代碼改成靜態(tài)的js提交搜索,參考下面代碼
<script type="text/javascript">function search(){var q = document.getElementById("q").value;window.location.href = "http://www.j4240.cn/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.j4240.cn/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>
電腦站偽靜態(tài)規(guī)則文件打包下載
![]() |
織夢偽靜態(tài)規(guī)則 |
包括iis6、iis7、8、apache、nginx,下載后選擇對應(yīng)的偽靜態(tài)規(guī)則文件
手機版?zhèn)戊o態(tài)教程開始
1.移動版域名 m.91084.com 解析并指向和綁定目錄到網(wǎng)站目錄的m文件夾
2.后臺-系統(tǒng)配置 添加變量
(為了使用絕對路徑,使用電腦版的文章圖片,為了移動版模板css、js、images使用絕對路徑)
變量名稱:cfg_mobile
變量類型:文本
參數(shù)說明:手機版網(wǎng)址
變量值:http://m.123.com
所屬組:站點設(shè)置
變量名稱:cfg_rewritem
變量類型:布爾(Y/N)
參數(shù)說明:手機版?zhèn)戊o態(tài)
變量值:Y
所屬組:站點設(shè)置

3.移動版當(dāng)前位置 {dede:field.position/} 標(biāo)簽動態(tài)改成偽靜態(tà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'];}
4.m文件夾文件添加和替換
手機站m文件夾目錄里添加了[搜索文件search.php]和[標(biāo)簽文件tags.php],還修改了以下3個文件
index.php list.php view.php
我已經(jīng)修改好并打包,如果你有改過,請備份你的再覆蓋我的
下載地址:
![]() |
文件替換 |
包括iis6、iis7、8、apache、nginx,下載后選擇對應(yīng)的偽靜態(tài)規(guī)則文件
5.把所有手機版模板文件(_m.htm 結(jié)尾的),把模板里面的代碼都改成電腦版
還有幾個特別的,請認(rèn)真對比下面
css、js、images 改成絕對路徑,例如 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/]">
上下篇記得先修正官方程序的這個BUG,已經(jīng)修正過的跳過
上一篇標(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=\"{$result['arcurl']}\">{$result['title']}</a>" : "上一篇:沒有了";{/dede:prenext}
下一篇標(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=\"{$result['arcurl']}\">{$result['title']}</a>" : "下一篇:沒有了";{/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}
欄目內(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}
搜索框代碼改成靜態(tài)的js提交搜索,參考下面代碼
<script type="text/javascript">function search(){var q = document.getElementById("q").value;window.location.href = "http://m.91084.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.91084.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>
電腦站跳轉(zhuǎn)到手機站代碼
1.首頁
<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>
2.列表
<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>
3.內(nèi)容
<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>