Discuz教程网

[代码修改] 去掉域名(默认首页)后面的/xxx.php DX2

[复制链接]
authicon dly 发表于 2012-8-17 17:45:39 | 显示全部楼层 |阅读模式
很多童鞋都在求助如何将域名后面的forum.php portal.php去掉。这里给大家提供一个方法

修改以前的效果:
https://www.discuz.1314study.com/forum.php
修改后的效果:
https://www.discuz.1314study.com
修改方法:

打开根目录下的index.php
查找:
  1. if(!empty($url)) {
  2. $delimiter = strrpos($url, '?') ? '&' : '?';
  3. if($_GET['fromuid']) {
  4. $url .= $delimiter.'fromuid='.$_GET['fromuid'];
  5. } elseif($_GET['fromuser']) {
  6. $url .= $delimiter.'fromuser='.$_GET['fromuser'];
  7. }
  8. header("HTTP/1.1 301 Moved Permanently");
  9. header("location: $url");
  10. } else {
  11. require './'.$_ENV['curapp'].'.php';
  12. }
复制代码

在前面加上:‘
  1. $url = '';
  2. $_ENV['curapp'] = 'portal';
复制代码

介绍:
如果想设置论坛为默认首页,把代码中的 $_ENV['curapp'] = 'portal'; 替换为 $_ENV['curapp'] = 'forum';
如果想要空间为默认首页:替换为 $_ENV['curapp'] = 'home';




上一篇:DIY时如何调用外部程序的数据
下一篇:最全discuz!X2.5去除forum.php尾巴的方法
authicon 洛羽脩 发表于 2012-9-4 19:00:40 | 显示全部楼层
不錯的教學~
也很方便~等等來更改
authicon 至尊ぉ子明 发表于 2012-9-23 14:52:45 | 显示全部楼层
路过看看吧.3
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2024-5-19 04:16

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

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