我們都知道,偽靜態(tài)就是建立在動態(tài)的基礎(chǔ)上的

當(dāng)我們做好了偽靜態(tài)后,在地址欄上打開動態(tài)鏈接時也是能正常打開的

如果不想讓別人或者搜索引擎還能打開動態(tài)鏈接,統(tǒng)一權(quán)重到偽靜態(tài)url上時,我們可以給動態(tài)鏈接上做個301跳轉(zhuǎn)

欄目列表頁301重定向?qū)崿F(xiàn)教程

比如織夢的欄目列表頁動態(tài)鏈接是

/plus/list.php?tid=1

打開動態(tài)鏈接時我們希望301重定向到偽靜態(tài)鏈接上去

/notes/

打開 /plus/list.php 找到

if($cfg_rewrite == 'Y')

{

...中間代碼省略

}

在它里面加入

if(stripos(GetCurUrl(), '.php'))

{

$typeurl = GetOneTypeUrlA($dsql->GetOne("SELECT * FROM `dede_arctype` WHERE id=$tid"));

header("Location: ".$typeurl, TRUE, 301);

exit();

}

如圖

 

 

內(nèi)容頁301重定向?qū)崿F(xiàn)教程

比如織夢的內(nèi)容頁動態(tài)鏈接是

 

/plus/view.php?aid=1

 

打開動態(tài)鏈接時我們希望301重定向到偽靜態(tài)鏈接上去

 

/notes/dede-safe.html

 

打開 /plus/view.php 找到

if($cfg_rewrite == 'Y')

{

...中間代碼省略

}

在它里面加入

if(stripos(GetCurUrl(), '.php'))

{

$url = GetOneArchive($aid);

header("Location: ".$url['arcurl'], TRUE, 301);

exit();

}

如圖