现在的位置: 首页 > Godaddy常见问题 > 正文

dedeecms 在GoDaddy windows主机上设置伪静态教程

2011年01月25日 常见问题 ⁄ 共 1979字 ⁄ 字号 暂无评论 ⁄ 阅读 2,956 views 次

dedecms以其易用性和支持采集,能生成静态页面等特性在中国有很大的用户群。虽然dede是php程序,但国内的环境中更多的人用的是asp或者asp类的程序,长期养成的习惯造成了很多情况下国内站长用的是windows主机。 GoDaddy的windows主机价格便宜,性价比高,在国内的影响力非同小可。

国内的这种找寻既支持asp又支持php的主机需求,使得GoDaddy更加脱颖而出。但也造成了有些程序php程序运行需要修改的问题。比如dedecms ,其本来的规则是要写到.htaccess这个文件的,但GoDaddy的windows主机支持在web.config里写伪静态。

下面分享一下如何在GoDaddy windows主机环境下为织梦(dedecms)写伪静态规则:

首先,建一个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 27240***/
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 27240***/

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

本文摘自美国主机侦探 论坛,原帖地址:http://bbs.idcspy.com/thread-158713-1-1.html 。更多的

GoDaddy主机设置伪静态规则请参考:http://bbs.idcspy.com/thread-71669-1-1.html

抱歉!评论已关闭.