搜索
首页CMS教程帝国CMS分享帝国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=&#39;&#39;;
if($line)
{
if($ln%$line==0)
{
$br=&#39;
&#39;;
}
}
$str.=$jg.&#39;<a href="&#39;.$public_r[newsurl].&#39;e/tags/?tagname=&#39;.urlencode($r[$i]).$cs.&#39;" target="_blank">&#39;.$r[$i].&#39;</a>&#39;
.$br;
$jg=$br?&#39;&#39;:$showjg;
}
}
else
{
$and=&#39;&#39;;
$where=&#39;&#39;;
if($cid)
{
$where=strstr($cid,&#39;,&#39;)?"cid in ($cid)":"cid=&#39;$cid&#39;";
$and=&#39; and &#39;;
}
if($isgood)
{
$where.=$and.&#39;isgood=1&#39;;
}
if($where)
{
$where=&#39; where &#39;.$where;
}
$order=$order?&#39; &#39;.$order:&#39; tagid desc&#39;;
$limit=&#39;&#39;;
if($num)
{
$limit=&#39; limit &#39;.$num;
}
//推荐标红
$gfont1=&#39;&#39;;
$gfont2=&#39;&#39;;
if($isgoodshow)
{
if(strstr($isgoodshow,&#39;r&#39;))
{
$gfont1=&#39;<font color="red">&#39;;
$gfont2=&#39;</font>&#39;;
}
if(strstr($isgoodshow,&#39;s&#39;))
{
$gfont1=$gfont1.&#39;&#39;;
$gfont2=&#39;&#39;.$gfont2;
}
}
$jg=&#39;&#39;;
$snum=&#39;&#39;;
$sql=$empire->query("select tagid,tagname,num,isgood from {$dbtbpre}enewstags".$where." order by".$order.
$limit);
while($r=$empire->fetch($sql))
{
if($shownum)
{
$snum=&#39;(&#39;.$r[num].&#39;)&#39;;
}
$font1=&#39;&#39;;
$font2=&#39;&#39;;
if($isgoodshow&&$r[isgood])
{
$font1=$gfont1;
$font2=$gfont2;
}
$ln++;
$br=&#39;&#39;;
if($line)
{
if($ln%$line==0)
{
$br=&#39;
&#39;;
}
}
//$str.=$jg.&#39;<a href="&#39;.$public_r[newsurl].&#39;e/tags/?tagid=&#39;.$r[tagid].$cs.&#39;" target="_blank">&#39;.$font1.$r[tagname].
$snum.$font2.&#39;</a>&#39;.$br;
$str.=$jg.&#39;<a href="&#39;.$public_r[newsurl].&#39;e/tags/&#39;.$r[tagid].&#39;.html" target="_blank">&#39;.$font1.$r[tagname].$snum.
$font2.&#39;</a>&#39;.$br;
$jg=$br?&#39;&#39;:$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伪静态的实现方法的详细内容。更多信息请关注PHP中文网其他相关文章!

声明
本文转载于:www.word666.com/cms。如有侵权,请联系admin@php.cn删除

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

SecLists

SecLists

SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

Dreamweaver Mac版

Dreamweaver Mac版

视觉化网页开发工具