问题: discuz手机版默认门户文章链接为portal.php?mod=view&aid=193967&mobile=2,如果被百度收录了pc端是无法打开的
解决思路:
打开网站后台,找到对应的门户文章伪静态规则我这里是(article-{id}-{page}.html)
1.使用FTP打开文件/source/function/function_portal.php,在文件内搜搜索fetch_article_url 在大概53行左右(如下图)
将下面的方法添加到fetch_article_url方法下
function fetch_article_murl($article) { global $_G; if(!empty($_G['setting']['makehtml']['flag']) && $article && $article['htmlmade']) { if(empty($_G['cache']['portalcategory'])) { loadcache('portalcategory'); } $caturl = ''; if(!empty($_G['cache']['portalcategory'][$article['catid']])) { $topid = $_G['cache']['portalcategory'][$article['catid']]['topid']; $caturl = $_G['cache']['portalcategory'][$topid]['domain'] ? $_G['cache']['portalcategory'][$topid]['caturl'] : ''; } return $caturl.$article['htmldir'].$article['htmlname'].'.'.$_G['setting']['makehtml']['extendname']; } else { //重点我这里用的article-'.$article['aid'].'-1.html和我后台显示的门户文章伪静态规则是一致的 //这里根据自理的伪静态规则进行设置$article['aid']为文章id return 'article-'.$article['aid'].'-1.html'; } }
2.找到自己安装的手机版模板/template/安装的模板/touch/portal/搜索fetch_article_url将所有fetch_article_url替换为fetch_article_murl,上传并保存(这里大概有三个文件view.php,list.php,index.php)
3.进入后台进行缓存