织梦伪静态后访问动态链接时301跳转到伪静态url上
类别:建站知识   时间:02-23

织梦伪静态就是建立在动态的基础上的,当我们做好了伪静态后,在地址栏上打开动态链接时也是能正常打开的

如果不想让别人或者搜索引擎还能打开动态链接,统一权重到伪静态url上时,我们可以给动态链接上做个301跳转。

织梦栏目列表页301重定向实现教程

比如织梦的栏目列表页动态链接是

https://www.lol9.cn/plus/list.php?tid=1

打开动态链接时我们希望301重定向到伪静态链接上去

https://www.lol9.cn/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();}

如图

织梦伪静态后访问动态链接时301跳转到伪静态url上

织梦内容页301重定向实现教程

比如织梦的内容页动态链接是

https://www.lol9.cn/plus/view.php?aid=1

打开动态链接时我们希望301重定向到伪静态链接上去

https://www.lol9.cn/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();}

如图

织梦伪静态后访问动态链接时301跳转到伪静态url上

完成。

智慧半岛,是一家专注于青岛网站建设青岛网站开发的青岛网络公司,Copyright ©2007-2019 Ebandao.Cn 版权所有 All Rights Reserved.(建议在1366x768以上的浏览器中访问)鲁ICP备08014496号

13153297890