首页 > CMS建站 > PhpCMS > 正文

phpcms去掉域名后面的index.html

2020-10-10 21:15:54
字体:
来源:转载
供稿:网友

dede彻底摆脱了,开始研究phpcms,先是去掉域名后面的index.html适合Seo,让栏目的链接变成www.Cuoxin.com/xxx/而不是http://www.Cuoxin.com/xxx/index.html.

方法有两种:

一种是用PHP的 str_replace函数将INDEX.HTML替换掉,代码如下:

  1. {php $data = subcat($module$catid);} 
  2. {loop $data $n $r
  3. <li><a href="{$str_replace("index.html","",$r[url])}" id="menu_{$r[catid]}"><span>{$r[catname]}</span></a></li> 
  4. {/loop} 

第二种是更改PHPCMS的URL规则,在URL规则中把“index.{$fileext} ”去掉,比如把:{$catdir}/index.{$fileext}|{$catdir}/{$page}.{$fileext} 改成 :{$catdir}|{$catdir}/{$page}.{$fileext}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表