一、在织梦后台启用伪静态,设置方法:登录织梦后台--系统---系统基本参数---核心设置,中将 是否使用伪静态: 设置为“是”如图,(注意,若之前站点栏目和文章是生成静态的,那么需重新设置生成为动态才可以,参考如图)
栏目和文章页面设置为动态请参考如图:
二、编辑/include/helpers/channelunit.helper.php文件,(修改前请将该文件复制一份,以免修改错误可以还原,备份文件是个好习惯) 1、查找:大约在227行
改成:global $cfg_typedir_df;
2、查找:大约在234行global $cfg_typedir_df, $cfg_rewrite;
改成:$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
三、将如下nginx规则文件添加到站点conf配置文件中,并重启nginx服务if($cfg_rewrite == 'Y')
{
$reurl = $GLOBALS["cfg_phpurl"]."/list-".$typeid.'.html';
}
else
{
//动态
$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid;
}
rewrite "^/list-([0-9]+)\.html$" /plus/list.php?tid=$1 last;
rewrite "^/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$" /plus/list.php?tid=$1&totalresult=$2&PageNo=$3 last;
rewrite "^/view-([0-9]+)-1\.html$" /plus/view.php?arcID=$1 last;
rewrite "^/view-([0-9]+)-([0-9]+)\.html$" /plus/view.php?aid=$1&pageno=$2 last;
rewrite "^/plus/list-([0-9]+)\.html$" /plus/list.php?tid=$1 last;
rewrite "^/plus/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$" /plus/list.php?tid=$1&totalresult=$2&PageNo=$3 last;
rewrite "^/plus/view-([0-9]+)-1\.html$" /plus/view.php?arcID=$1 last;
rewrite "^/plus/view-([0-9]+)-([0-9]+)\.html$" /plus/view.php?aid=$1&pageno=$2 last;
rewrite "^/tags.html$" /tags.php last;
rewrite "^/tag-([0-9]+)-([0-9]+)\.html$" /tags.php?/$1/$2/ last;
若上面规则有问题,可试下如下伪静态规则:
rewrite "^/index.html$" /index.php last;
rewrite "^/list-([0-9]+)\.html$" /plus/list.php?tid=$1 last;
rewrite "^/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$" /plus/list.php?tid=$1&totalresult=$2&PageNo=$3 last;
rewrite "^/view-([0-9]+)-1\.html$" /plus/view.php?arcID=$1 last;
rewrite "^/view-([0-9]+)-([0-9]+)\.html$" /plus/view.php?aid=$1&pageno=$2 last;
rewrite "^/tags.html$" /tags.php last;
rewrite "^/tag-([0-9]+)-([0-9]+)\.html$" /tags.php?/$1/$2/ last;
至此,织梦伪静态设置完成,测试列表和内容页伪静态都可正常访问了, 本文由301免备案跳转原创,转载请注明出处:https://www.zfcdn.xyz/showinfo-18-35783-0.html 否则将追究法律责任
文章评论 本文章有个评论