dedecms 5.5 伪静态化ReWrite规则

来源:Asp之家 时间:2010-12-08 16:47:00 

个人修改记录,不一定适合大众.

列表命名规则:

 
/list/list-{tid}-{page}.html

文章命名规则:


/test/{Y}{M}/{aid}.html

.htaccess


RewriteRule ^([a-zA-Z]+)/([0-9]+)/([0-9]+)\.html$ /plus/view.php?arcID=$3
RewriteRule ^([a-zA-Z]+)/([0-9]+)/([0-9]+)-([0-9]+)\.html$ /plus/view.php?aid=$3&pageno=$4

include/arc.archives.class.php


//获得动态页面分页列表
function GetPagebreakDM($totalPage,$nowPage,$aid)
{
global $cfg_rewrite;
if($totalPage==1)
{
return “”;
}
$PageList = “<li><a>共”.$totalPage.”页: </a></li>”;
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1)
{
$PageList.=”<li><a href=’#'>上一页</a></li>”;
}
else
{
if($nPage==1)
{
$PageList.=”<li><a href=’view.php?aid=$aid’>上一页</a></li>”;
if($cfg_rewrite == ‘Y’)
{
$PageList = preg_replace(“/view.php\?aid=(\d+)/i”,’-\\1-1.html’,$PageList);
}
}
else
{
$PageList.=”<li><a href=’view.php?aid=$aid&pageno=$nPage’>上一页</a></li>”;
if($cfg_rewrite == ‘Y’)
{
$PageList = str_replace(“view.php?aid=”,“”,$PageList);
$PageList = preg_replace(“/&pageno=(\d+)/i”,’-\\1.html’,$PageList);
}
}
}
for($i=1;$i<=$totalPage;$i++)
{
if($i==1)
{
if($nowPage!=1)
{
$PageList.=”<li><a href=’view.php?aid=$aid’>1</a></li>”;
if($cfg_rewrite == ‘Y’)
{
$PageList = preg_replace(“/view.php\?aid=(\d+)/i”,’-\\1-1.html’,$PageList);
}
}
else
{
$PageList.=”<li class=\”thisclass\”><a>1</a></li>”;
}
}
else
{
$n = $i;
if($nowPage!=$i)
{
$PageList.=”<li><a href=’view.php?aid=$aid&pageno=$i’>”.$n.”</a></li>”;
if($cfg_rewrite == ‘Y’)
{
$PageList = str_replace(“view.php?aid=”,“”,$PageList);
$PageList = preg_replace(“/&pageno=(\d+)/i”,’-\\1.html’,$PageList);
}
}
else
{
$PageList.=”<li class=\”thisclass\”><a href=’#'>{$n}</a></li>”;
}
}
}
if($lPage <= $totalPage)
{
$PageList.=”<li><a href=’view.php?aid=$aid&pageno=$lPage’>下一页</a></li>”;
if($cfg_rewrite == ‘Y’)
{
$PageList = str_replace(“view.php?aid=”,“”,$PageList);
$PageList = preg_replace(“/&pageno=(\d+)/i”,’-\\1.html’,$PageList);
}
}
else
{
$PageList.= “<li><a href=’#'>下一页</a></li>”;
}
return $PageList;
}
//获得静态页面分页列表
function GetPagebreak($totalPage,$nowPage,$aid)
{
if($totalPage==1)
{
return “”;
}
$PageList = “<li><a>共”.$totalPage.”页: </a></li>”;
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1)
{
$PageList.=”<li><a href=’#'>上一页</a></li>”;
}
else
{
if($nPage==1)
{
$PageList.=”<li><a href=’”.$this->NameFirst.”.”.$this->ShortName.”‘>上一页</a></li>”;
}
else
{
$PageList.=”<li><a href=’”.$this->NameFirst.“-”.$nPage.”.”.$this->ShortName.”‘>上一页</a></li>”;
}
}
for($i=1;$i<=$totalPage;$i++)
{
if($i==1)
{
if($nowPage!=1)
{
$PageList.=”<li><a href=’”.$this->NameFirst.”.”.$this->ShortName.”‘>1</a></li>”;
}
else
{
$PageList.=”<li class=\”thisclass\”><a href=’#'>1</a></li>”;
}
}
else
{
$n = $i;
if($nowPage!=$i)
{
$PageList.=”<li><a href=’”.$this->NameFirst.“-”.$i.”.”.$this->ShortName.”‘>”.$n.”</a></li>”;
}
else
{
$PageList.=”<li class=\”thisclass\”><a href=’#'>{$n}</a></li>”;
}
}
}
if($lPage <= $totalPage)
{
$PageList.=”<li><a href=’”.$this->NameFirst.“-”.$lPage.”.”.$this->ShortName.”‘>下一页</a></li>”;
}
else
{
$PageList.= “<li><a href=’#'>下一页</a></li>”;
}
return $PageList;
}

include/arc.listview.class.php


$plist = str_replace(‘&TotalResult=’, ‘-’, $plist);

去除动态列表网址里带有列表的文章总数


$plist = preg_replace(“/&TotalResult=(\d+)/i”, ”, $plist);

标签:dedecms,rewrite,伪静态
0
投稿

猜你喜欢

  • 使用命令行配置Windows 2008防火墙

    2009-01-06 14:14:00
  • 稳定性释疑 国外主机是否有CPU Time限制

    2009-01-19 16:52:00
  • 如何不作弊提高GOOGLE ADSENSE广告单价

    2008-10-13 17:52:00
  • GoDaddy域名解析服务器地址 Godaddy

    2010-04-24 12:57:00
  • 服务器虚拟化的必须考虑的十大因素

    2010-08-15 18:35:00
  • 金山爱词霸完善社区服务 推出社交网络平台E社会

    2009-10-28 14:53:00
  • 详解Docker Volume 之权限管理

    2023-06-24 18:58:45
  • 详解CentOs设置静态IP的方法

    2023-12-14 11:18:54
  • Apache与Tomcat服务器整合的基本配置方法及概要说明

    2023-10-19 16:32:32
  • 稳定无优的网赚-出售文字链接赚钱

    2009-05-24 10:13:00
  • 预防DDoS攻击的十项安全策略

    2009-12-24 14:03:00
  • 构建反病毒反垃圾邮件系统(五)

    2007-09-30 10:53:00
  • 优化Apache服务器的重负荷

    2007-11-01 14:02:00
  • 挖掘自己内在的潜能吧

    2009-10-25 13:15:00
  • 详解完美解决MacOS catalina 升级后Vmware黑屏的问题

    2022-11-05 22:15:34
  • 浅谈Linux优化及安全配置的个人体会

    2009-02-10 17:56:00
  • SEO和用户体验

    2007-10-15 18:33:00
  • 选择主机须注意的六点

    2010-03-25 11:17:00
  • Windows操作系统组策略应用全攻略(1)

    2010-05-31 19:09:00
  • 解决docker 容器设置中文语言包出现的问题

    2023-08-17 07:18:04
  • asp之家 网站运营 m.aspxhome.com