我們都知道,偽靜態就是建立在動態的基礎上的

當我們做好了偽靜態后,在地址欄上打開動態鏈接時也是能正常打開的

如果不想讓別人或者搜索引擎還能打開動態鏈接,統一權重到偽靜態url上時,我們可以給動態鏈接上做個301跳轉

欄目列表頁301重定向實現教程

比如織夢的欄目列表頁動態鏈接是

/plus/list.php?tid=1

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

/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();

}

如圖

 

 

內容頁301重定向實現教程

比如織夢的內容頁動態鏈接是

 

/plus/view.php?aid=1

 

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

 

/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();

}

如圖