当我们做好了伪静态后,在地址栏上打开动态链接时也是能正常打开的
如果不想让别人或者搜索引擎还能打开动态链接,统一权重到伪静态url上时,我们可以给动态链接上做个301跳转
栏目列表页301重定向实现教程
比如织梦的栏目列表页动态链接是
https://www.tioo.net/plus/list.php?tid=1
打开动态链接时我们希望301重定向到伪静态链接上去
https://www.tioo.net/seojc/
打开 /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重定向实现教程
比如织梦的内容页动态链接是
https://www.tioo.net/plus/view.php?aid=1
打开动态链接时我们希望301重定向到伪静态链接上去
https://www.tioo.net/notes/seojc/
打开 /plus/view.php 找到
if($cfg_rewrite == 'Y') { ...中间代码省略 } |
在它里面加入
if(stripos(GetCurUrl(), '.php')) { $url = GetOneArchive($aid); header("Location: ".$url['arcurl'], TRUE, 301); exit(); } |
如图

TAG标签页重定向实现教程
打开 /tags.php 找到
$dlist->Display(); |
如果你的TAG标签使用的是拼音的方式,在它的上面加入
if(stripos(GetCurUrl(), '.php')) { $link = $cfg_cmsurl."/tags/".GetPinyin($tag).".html"; header("Location: ".$link, TRUE, 301); exit(); } |
如果你的TAG标签使用的是ID的方式,在它的上面加入
if(stripos(GetCurUrl(), '.php')) { $link = $cfg_cmsurl."/tags/".$dlist->TagInfos['id'].".html"; header("Location: ".$link, TRUE, 301); exit(); } |
如果你的TAG标签用的是文字的方式,在它的上面加入
if(stripos(GetCurUrl(), '.php')) { $link = $cfg_cmsurl."/tags/".$tag.".html"; header("Location: ".$link, TRUE, 301); exit(); } |
根据自己的情况来
完成