帝国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偽靜態的實作方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

mPDF
mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

SublimeText3 Linux新版
SublimeText3 Linux最新版

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

SublimeText3漢化版
中文版,非常好用

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。