織夢偽靜態就是建立在動態的基礎上的,當我們做好了偽靜態后,在地址欄上打開動態鏈接時也是能正常打開的
如果不想讓別人或者搜索引擎還能打開動態鏈接,統一權重到偽靜態url上時,我們可以給動態鏈接上做個301跳轉。
比如織夢的欄目列表頁動態鏈接是
https://www.CUOxin.com/plus/list.php?tid=1
打開動態鏈接時我們希望301重定向到偽靜態鏈接上去
https://www.CUOxin.com/notes/
1.打開 /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();} |
如圖
比如織夢的內容頁動態鏈接是
https://www.CUOxin.com/plus/view.php?aid=1
打開動態鏈接時我們希望301重定向到偽靜態鏈接上去
https://www.CUOxin.com/note/1.html
1.打開 /plus/view.php 找到
if($cfg_rewrite == 'Y'){...中間代碼省略} |
在它里面加入
if(stripos(GetCurUrl(), '.php')){$url = GetOneArchive($aid);header("Location: ".$url['arcurl'], TRUE, 301);exit();} |
如圖
完成。
新聞熱點
疑難解答