请选择 进入手机版 | 继续访问电脑版

苏苏网赚论坛

 找回密码
 立即注册
查看: 487|回复: 0

最少更改,实现 discuz 论坛的地址栏采用标题拼音

[复制链接]
发表于 2018-1-8 20:23:58 | 显示全部楼层 |阅读模式
问题描述:
最近有SEO的兄弟求我帮忙将 discuz 论坛的帖子标题搞到 url 里面去,比如
帖子为 "为什么花这样红" ,对应的地址就是 weishenmohuazheyanghong-t-1-1.html
据说这样有助于搜索引擎搜录
问题解决:
我查看了discuz 的php代码,发现只需要做很小的改动就可以实现此功能:
现代码如下:
include/global.func.php 修改
function rewrite_thread($tid, $page = 0, $prevpage = 0, $extra = '') {
$pinyin = pinyin(getthread($tid));
return '';
}
function rewrite_forum($fid, $page = 0, $extra = '') {
$pinyin = pinyin(getforum($fid));
return '';
}
在文件最下添加
include_once 'phpsir_rewrite_pinyin.php';
新增 phpsir_rewrite_pinyin.php 文件内容

还有一点就是修改 .htaccess 加入

RewriteRule ^(.*)-f-([0-9]+)-([0-9]+).html$ forumdisplay.php?fid=$2&page=$3
RewriteRule ^(.*)-t-([0-9]+)-([0-9]+)-([0-9]+).html$ viewthread.php?tid=$2&extra=page%3D$4&page=$3

搞定
热帖推荐
回复

使用道具 举报

广告合作|最大的网赚客中文交流社区!十年老站!

GMT+8, 2024-3-29 08:59 , Processed in 0.124800 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.1 VIP版

© 2012-2022 苏苏网赚论坛 版权所有 | 10年老品牌

快速回复 返回顶部 返回列表