找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2501|回复: 0

[分享] dedecms如何正确设置301教程‎

[复制链接]
发表于 2012-3-22 13:44:18 | 显示全部楼层 |阅读模式 来自 浙江省绍兴市诸暨市
本帖最后由 落叶潇潇下 于 2012-3-23 23:26 编辑

适用于绑定了两个域名的网站,将不带www的转向带www的
首先在空间设置里将index.php的优先级设为最高
然后编辑根目录下的index.php 替换为以下代码
复制代码
1. 2. //-----------------------------------------------
3. //ad:www.dodomai.com
4. //-----------------------------------------------
5. $jump301=1;//是否开启301跳转开关,1开 0关
6. $index_file='index.html';//首页文件 不支持SSI(shtml/shtm)
7.
8. if(substr($_SERVER['SERVER_NAME'],0,4)!='www.'&&$jump301)
9. {
10. header('HTTP/1.1 301 Moved Permanently');
11. header('Location:http://www.'.$_SERVER['SERVER_NAME']);
12. exit();
13. }
14.
15.
16.
17. if(!file_exists(dirname(__FILE__).'/data/common.inc.php'))
18. {
19. header('Location:install/index.php');
20. exit();
21. }
22. //自动生成HTML版
23. if(isset($_GET['upcache']))
24. {
25. require_once (dirname(__FILE__) . "/include/common.inc.php");
26. require_once DEDEINC."/arc.partview.class.php";
27. $GLOBALS['_arclistEnv'] = 'index';
28. $row = $dsql->GetOne(“Select * From `dede_homepageset`”);
29. $row['templet'] = MfTemplet($row['templet']);
30. $pv = new PartView();
31. $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . “/” . $row['templet']);
32. $pv->SaveToHtml(dirname(__FILE__).’/’.$index_file);
33. include(dirname(__FILE__).’/’.$index_file);
34. exit();
35. }
36. include(dirname(__FILE__).’/’.$index_file);
37. ?>
38.
ok,大功告成,去查询工具查一下吧

评分

参与人数 1金币 -30 收起 理由
天外飘仙 -30 明显发错分类

查看全部评分

发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;

如何回报帮助你解决问题的坛友,好办法就是点击帖子下方的评分按钮给对方加【金币】不会扣除自己的积分,做一个热心并受欢迎的人!

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则 需要先绑定手机号

关闭

站长推荐上一条 /1 下一条

QQ|侵权投诉|广告报价|手机版|小黑屋|西部数码代理|飘仙建站论坛 ( 豫ICP备2022021143号-1 )

GMT+8, 2024-5-2 15:41 , Processed in 0.038343 second(s), 14 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表