首页 > 网站 > 建站经验 > 正文

DEDECMS 在 godaddy 空间的伪静态设置方法详解

2024-04-25 20:48:25
字体:
来源:转载
供稿:网友

不会正则,模仿加修改(花了N多个小时),终于能正常运行了,不知道写得对不对,说一说让需要的友友们参考 
首先,建一个web.config 放在根目录下,web.config 内容为

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
<system.webServer> 
<rewrite> 
<rules> 
                <rule name="Rewrite to index.php"> 
                    <match url="/index.html$" /> 
                    <action type="Rewrite" url="index.php" /> 
                </rule> 
                <rule name="Rewrite to list.php"> 
                    <match url="^plus/list-([0-9]+).html$" /> 
              <action type="Rewrite" url="plus/list.php/?tid={R:1}" /> 
                </rule> 
                <rule name="Rewrite to list.php?"> 
                    <match url="^plus/list-([0-9]+)-([0-9]+)-([0-9]+).html$" /> 
              <action type="Rewrite" url="plus/list.php/?tid={R:1}&TotalResult={R:2}&PageNo={R:3}" /> 
                </rule>

                <rule name="Rewrite to view.php"> 
                    <match url="^plus/view-([0-9]+)-([0-9]+).html$" /> 
                    <action type="Rewrite" url="plus/view.php/?aid={R:1}&pageno={R:2}" /> 
                </rule> 
</rules> 
</rewrite> 
<httpErrors errorMode="Detailed" /> 
<asp scriptErrorSentToBrowser="true" /> 
</system.webServer> 
<system.web> 
<customErrors mode="Off" /> 
<globalization requestEncoding="utf-8" resp*****eEncoding="utf-8" fileEncoding="utf-8" /> 
</system.web> 
</configuration>

2、在dedecms 后台的“系统设置”–“基本参数设置”–“核心设置”(核心设置中的“是否使用伪静态”把“是”选上)

这时,“文章内容显示页”的伪静态已经算是设置好了。

3、如果还想将列表页面设置成伪静态的,则要改一下 include 目录下的 channelunit.func.php  文件即 (include/channelunit.func.php  )

大约在164行会发现这样的代码: 
  //动态 
  $reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid; 
把这句“$reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid; ”注释掉

加上下面的这几句代码

/**修改栏目伪静态 by 163pinger***/ 
global $cfg_rewrite; 
if($cfg_rewrite == ‘Y’) { 
   $reurl = $GLOBALS["cfg_plus_dir"]."/list-".$typeid.".html";  
}else{ 
   $reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid; 

/**修改栏目伪静态 by 163pinger***/

最后保存,好了,试一下,是不是变成伪静态了呢?! (最后要记得,发表文章或建栏目时把“仅动态”选上

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