曼钧 發表於 2023-8-21 00:00:00

dedecms 伪静态重写设置修改方法

<p>
        <span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>1. 首先栏目和文章最好设置成动态浏览. 这样才不会生成静态html文件. Dede教程-598080707.NET </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>2. 设置重写规则. 在系统目录下加一个 .htaccess文件. 内容为 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这里需要注意的是:Linux操作系统才支持(.htaccess).windows操作系统不支持(.htaccess),所以说此教程是只有Linux操作系统的空间才能使用的方法: </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <p class="right">
                <span><u>复制代码</u></span></p>
        <p>
                代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        RewriteEngine On <br>
        RewriteRule ^plus/list-(+)\.html$ /plus/list.php?tid=$1 <br>
        RewriteRule ^plus/list-(+)-(+)-(+)\.html$ /plus/list.php?tid=$1&amp;totalresult=$2&amp;PageNo=$3 <br>
        RewriteRule ^plus/view-(+)-1\.html$ /plus/view.php?arcID=$1 <br>
        RewriteRule ^plus/view-(+)-(+)\.html$ /plus/view.php?aid=$1&amp;pageno=$2 </p>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>如果你的系统支持url重写,到这里就可以用伪静态访问了. </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>3.更改重写的URL. 找到文件/include/channelunit.func.php打开. </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>可以看到有这样的语句 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>return $GLOBALS["cfg_plus_dir"]."/view-".$aid.'-1.html'; </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这就是文章的url形色. </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid; </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这是列表的重写url. </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>可以使url更短一点,完成可以写成: return "/view-".$aid.'-1.html';  和  $reurl = "/list-".$typeid.".html"; </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这时重写规则也要更新. </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <p class="right">
                <span><u>复制代码</u></span></p>
        <p>
                代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        RewriteEngine On <br>
        RewriteRule ^list-(+)\.html$ /plus/list.php?tid=$1 <br>
        RewriteRule ^list-(+)-(+)-(+)\.html$ /plus/list.php?tid=$1&amp;totalresult=$2&amp;PageNo=$3 <br>
        RewriteRule ^view-(+)-1\.html$ /plus/view.php?arcID=$1 <br>
        RewriteRule ^view-(+)-(+)\.html$ /plus/view.php?aid=$1&amp;pageno=$2 </p>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>更进一步,还可以把view换成自己的任何词语,这也要把include/arc.archives.class.php文件中的view也一样替换。</span></p>
頁: [1]
查看完整版本: dedecms 伪静态重写设置修改方法