织梦dedecms移动端内容页图片附件绝对路径修改方法

2019-10-2107:21:31网站建设与开发Comments2,524 views字数 600阅读模式

从SEO的角度考虑还是网站增加手机端后的图片和附件的显示,我们都希望织梦dedecms内页的图片和附件的地址是绝对路径,当然如果有兴趣的朋友可以移步《织梦dedecms栏目静态生成后分页URL链接相对路径修改方法》参看分页相对路径修改成绝对路径的方法。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

下面我们主要介绍一下,织梦dedecms移动端内容页图片附件绝对路径修改方法:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

一、用SQL批量修改域名下的所有文章

1.后台-核心-批量维护-数据库内容替换文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

2.选择频道设置对应的表,如dede_addonaticle文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

3.选择body文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

4.被替换内容:src="/uploads/文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

5.替换为:src="http://域名/uploads/文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

6.点击“开始替换”文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

7.重新生成文章即可。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

PS:361源码提醒:做替换之前,务必看准表名已经做好备份工作。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

二、修改后台源代码

1.找到include的文件extend.func.php文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

2.在文件最后增加一个函数(在php函数的结束括号外)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

function replaceurl($newurl)
{
$newurl=str_replace('src="/uploads/','src="http://域名/uploads/',$newurl);
return $newurl;
}

3.文章正文调用标签{dede:}修改成{dede:field.body function='replaceurl(@me)'/}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

4.更新一下即可。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/16862.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/cms/16862.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定