2015-04-09 3 views
1

На моем локальном хост-компьютере все идеально, но на рабочем сервере я не могу переопределить переднюю страницу по умолчанию, то есть пользовательский индекс, с тем, который я создал, вместо этого я всегда перенаправляюсь в/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/

+0

У вас есть '.htaccess' файл (если используется Apache) или каких-либо редирект (если nginx)? –

+0

Да, у меня есть .htaccess in/public_html @Joey Ciechanowicz –

+0

Что в '.htaccess'? Любой URL переписывает? –

ответ

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; 
} 
Смежные вопросы