无法重定向到自定义首页

时间:2015-04-09 09:12:27

标签: php production-environment production elgg

在我的本地主机上,一切都很完美,但在生产服务器上,我无法覆盖前面的默认页面,即自定义索引,我创建了一个,而不是总是被重定向到/ activity。

start.php

elgg_register_plugin_hook_handler('index', 'system', 'custom_index', 0);

function custom_index($hook, $type, $return, $params) {
    if ($return == true) {
        // another hook has already replaced the front page
        return $return;
    }

    if (!include_once("/pages/rev_index.php")) {
        return false;
    }

    // return true to signify that we have handled the front page
    return true;
}

我只接受http://domain-name.com/activity而不是http://domain-name.com/

1 个答案:

答案 0 :(得分:0)

服务器上的默认路径配置出现问题。使用绝对路径,即。 include_once( DIR 。" /pages/rev_index.php")使其有效:

start.php

elgg_register_plugin_hook_handler('index', 'system', 'custom_index', 0);

function custom_index($hook, $type, $return, $params) {
    if ($return == true) {
        // another hook has already replaced the front page
        return $return;
    }

    if (!include_once(__DIR__ . "/pages/rev_index.php")) {
        return false;
    }

    // return true to signify that we have handled the front page
    return true;
}