Search code examples
phpelgg

Can only do override plugin hooks on localhost but not on production server


On my local host machine, everything's perfect, but on production server, I cannot override the front default page, that is the custom index.

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;
}

I only get reffered to http://domain-name.com/activity instead of http://domain-name.com/


Solution

  • You may have problem with default paths configuration on your server. It's safer to use absolute path, ie. include_once(__DIR__ . "/pages/rev_index.php")