These are chat archives for jbroadway/elefant

Feb 2014
Feb 26 2014 02:51
is possible to rename the apps/admin so we can access admin page under for security reason ? how to ?
Johnny Broadway
Feb 26 2014 03:10
There’s one thing you could try
If you create a bootstrap.php in your root folder with something like this:
if (preg_match ('|^/newadminpanel?/?|', $_SERVER['REQUEST_URI'])) {
    $_SERVER['REQUEST_URI'] = '/admin' . $_SERVER['REQUEST_URI'];
Or even just this:
$_SERVER['REQUEST_URI'] = preg_replace ('^/newadminpanel', '/admin', $_SERVER['REQUEST_URI']);
Then you could add a rule to the web server config to return 404 for ^/admin.*
The bootstrap would reroute the requests so Elefant will think it’s seeing /admin.
Johnny Broadway
Feb 26 2014 03:16
Actually, you’ll also need to add a “hook” to rewrite links in the output as well. Hooks are listed in the global config. I would add this:
page/render[] = myapp/adminrewrite
Then create a PHP script at apps/myapp/handlers/adminrewrite.php with something like this:

echo str_replace ('"/admin', '"/newadminpanel', $data['html']);

So there’s 3 parts: 1) The rewrite in the bootstrap for incoming requests, 2) The page/render hook to rewrite outgoing links, and 3) The server config to return 404 at /admin (otherwise you’ll have just created an alias :) )
Feb 26 2014 03:33
Thank you ! You're awesome !
Johnny Broadway
Feb 26 2014 03:40
No worries! :)