DEDECMS系統(tǒng)欄目、文章頁(yè)面、分頁(yè)面?zhèn)戊o態(tài)詳細(xì)方法

字號(hào):


    DEDECMS系統(tǒng)欄目、文章頁(yè)面、分頁(yè)面?zhèn)戊o態(tài)和域名301重定向詳細(xì)方法:
    1、服務(wù)器必須支持URL重寫(xiě)。
    2、后臺(tái)開(kāi)啟偽靜態(tài)。
    3、欄目設(shè)置使用動(dòng)態(tài)。
    4。添加文檔時(shí)選擇使用動(dòng)態(tài)瀏覽。
    5。需要修改php文件include/channelunit.func.php
    查找
    return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html';
    修改為
    return "/view-".$aid.'-1.html';
    查找
    return $GLOBALS['cfg_phpurl']."/view.php?aid=$aid";
    修改為
    return "/view.php?aid=$aid";
    其實(shí)不修改也可以,但是URL地址會(huì)長(zhǎng)一點(diǎn)。這個(gè)是文章的。
    查找
    $reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
    修改為
    $reurl = "/list-".$typeid.".html";
    這個(gè)必須修改,是欄目頁(yè)的。
    6、需要在根目錄下增加一個(gè).htaccess文件(只適用于linux系統(tǒng),并需要虛擬主機(jī)支持)。
    添加如下:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{http_host} ^xianjianhot.com [NC]
    RewriteRule ^(.*)$ http://www.xianjianhot.com/$1 [L,R=301]
    RewriteRule ^list-([0-9]+).html$ /plus/list.php?tid=$1
    RewriteRule ^list-([0-9]+)-([0-9]+)-([0-9]+).html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3
    RewriteRule ^view-([0-9]+)-1.html$ /plus/view.php?arcID=$1
    RewriteRule ^view-([0-9]+)-([0-9]+).html$ /plus/view.php?aid=$1&pageno=$2
    </IfModule>
    說(shuō)明:
    1、
    RewriteCond %{http_host} ^xianjianhot.com [NC]
    RewriteRule ^(.*)$ http://www.xianjianhot.com/$1 [L,R=301]
    此為域名301重定向指令,放在其它重寫(xiě)命令前面。其中域名替換成自己網(wǎng)站域名。這有利于網(wǎng)站的SEO。如果不看重則可以不要。
    2、
    RewriteRule ^view-([0-9]+)-([0-9]+).html$ /plus/view.php?aid=$1&pageno=$2
    此為文章分頁(yè)重寫(xiě)命令。如果view替換成自己設(shè)置的其他詞,則需要把include/arc.archives.class.php文件中的view同時(shí)替換掉。
    3、
    偽靜態(tài)可能會(huì)出現(xiàn)多個(gè)url都是指向相同頁(yè)面,如果看重SEO效果,則可用robots.txt屏蔽多余url。