织梦伪静态就是建立在动态的基础上的,当我们做好了伪静态后,在地址栏上打开动态链接时也是能正常打开的
如果不想让别人或者搜索引擎还能打开动态链接,统一权重到伪静态url上时,我们可以给动态链接上做个301跳转。
织梦栏目列表页301重定向实现教程
比如织梦的栏目列表页动态链接是
https://www.lol9.cn/plus/list.php?tid=1
打开动态链接时我们希望301重定向到伪静态链接上去
https://www.lol9.cn/notes/
1.打开 /plus/list.php 找到
1 |
if ($cfg_rewrite == 'Y' ) |
|
在它里面加入
1 |
if (stripos(GetCurUrl(), '.php' )) |
3 |
$typeurl = GetOneTypeUrlA($dsql->GetOne( "SELECT * FROM `dede_arctype` WHERE id=$tid" )); |
4 |
header( "Location: " .$typeurl, TRUE, 301); |
|
如图
织梦内容页301重定向实现教程
比如织梦的内容页动态链接是
https://www.lol9.cn/plus/view.php?aid=1
打开动态链接时我们希望301重定向到伪静态链接上去
https://www.lol9.cn/note/1.html
1.打开 /plus/view.php 找到
1 |
if ($cfg_rewrite == 'Y' ) |
|
在它里面加入
1 |
if (stripos(GetCurUrl(), '.php' )) |
3 |
$url = GetOneArchive($aid); |
4 |
header( "Location: " .$url[ 'arcurl' ], TRUE, 301); |
|
如图
完成。