当前位置:首页站长学院帝国CMS分享帝国cms网站优化使tags伪静态的实现方法
企业营销,就选知企PROSAAS

分享帝国cms网站优化使tags伪静态的实现方法

分享帝国cms网站优化使tags伪静态的实现方法

帝国cms网站优化值tags伪静态的实现步骤如下:

1.修改e/class/t_functions.php中的sys_eShowTags函数

代码如下:

//显示TAGS
function sys_eShowTags($cid,$num=0,$line=0,$order='',$isgood='',$isgoodshow='',$showjg='',$shownum=0,$cs=''){
global $empire,$dbtbpre,$public_r,$navinfor;
$str='';
if(empty($showjg))
{
$showjg='   ';
}
$ln=0;
if($cid=='selfinfo')
{
if(empty($navinfor['infotags']))
{
return '';
}
$jg='';
$r=explode(',',$navinfor['infotags']);
$count=count($r);
for($i=0;$i<$count;$i++)
{
$ln++;
$br='';
if($line)
{
if($ln%$line==0)
{
$br='
';
}
}
$str.=$jg.'<a href="'.$public_r[newsurl].'e/tags/?tagname='.urlencode($r[$i]).$cs.'" target="_blank">'.$r[$i].'</a>'
.$br;
$jg=$br?'':$showjg;
}
}
else
{
$and='';
$where='';
if($cid)
{
$where=strstr($cid,',')?"cid in ($cid)":"cid='$cid'";
$and=' and ';
}
if($isgood)
{
$where.=$and.'isgood=1';
}
if($where)
{
$where=' where '.$where;
}
$order=$order?' '.$order:' tagid desc';
$limit='';
if($num)
{
$limit=' limit '.$num;
}
//推荐标红
$gfont1='';
$gfont2='';
if($isgoodshow)
{
if(strstr($isgoodshow,'r'))
{
$gfont1='<font color="red">';
$gfont2='</font>';
}
if(strstr($isgoodshow,'s'))
{
$gfont1=$gfont1.'';
$gfont2=''.$gfont2;
}
}
$jg='';
$snum='';
$sql=$empire->query("select tagid,tagname,num,isgood from {$dbtbpre}enewstags".$where." order by".$order.
$limit);
while($r=$empire->fetch($sql))
{
if($shownum)
{
$snum='('.$r[num].')';
}
$font1='';
$font2='';
if($isgoodshow&&$r[isgood])
{
$font1=$gfont1;
$font2=$gfont2;
}
$ln++;
$br='';
if($line)
{
if($ln%$line==0)
{
$br='
';
}
}
//$str.=$jg.'<a href="'.$public_r[newsurl].'e/tags/?tagid='.$r[tagid].$cs.'" target="_blank">'.$font1.$r[tagname].
$snum.$font2.'</a>'.$br;
$str.=$jg.'<a href="'.$public_r[newsurl].'e/tags/'.$r[tagid].'.html" target="_blank">'.$font1.$r[tagname].$snum.
$font2.'</a>'.$br;
$jg=$br?'':$showjg;
}
}
echo $str;

}

推荐学习《帝国cms教程》

2.网站根目录 增加.htaccess文件,内容如下

代码如下:

RewriteEngine On
RewriteBase /
RewriteRule tag/(.*).html$ e/tags/?tagname=$1
RewriteRule e/tags/(.*).html$ e/tags/?tagid=$1

还要空间支持伪静态

1.检测Apache是否支持mod_rewrite 通过php提供的phpinfo()函数查看环境配置,通过Ctrl+F查找到“Loaded Modules”,其中列出了所有apache2handler已经开启的模块,如果里面包括“mod_rewrite”,则已经支持,不再需要继续设置。
如果没有开启“mod_rewrite”,则打开目录 您的apache安装目录“/apache/conf/” 下的 httpd.conf 文件,通过Ctrl+F查找到“LoadModule rewrite_module”,将前面的”#”号删除即可。
如果没有查找到,则到“LoadModule” 区域,在最后一行加入“LoadModule rewrite_module modules/mod_rewrite.so”(必选独占一行),然后重启apache服务器即可。

2.让apache服务器支持.htaccess

修改httpd.conf文件

代码如下:

Options FollowSymLinks
AllowOverride None

改为

代码如下:

Options FollowSymLinks
AllowOverride All

以上就是分享帝国cms网站优化使tags伪静态的实现方法的详细内容,更多请关注知企PROSAAS其它相关文章!

温馨提示:

文章标题:分享帝国cms网站优化使tags伪静态的实现方法

文章链接:https://ceshi.prosaas.cn/3517.html

更新时间:2019年11月30日

声明: 本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:973664285@qq.com我们将第一时间处理! 资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。 所有资源仅限于参考和学习,版权归原作者所有,更多请阅读知企PROSAAS协议

给TA打赏
共{{data.count}}人
人已打赏
帝国CMS

分享帝国CMS7.0实现记录所有浏览访问的会员的方法

2019-11-29 14:25:14

帝国CMS

帝国CMS自动截取简介出现乱码的解决方法

2019-11-30 11:24:56

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索