Skip to content

Instantly share code, notes, and snippets.

@jbroadway
Last active August 29, 2015 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbroadway/9251281 to your computer and use it in GitHub Desktop.
Save jbroadway/9251281 to your computer and use it in GitHub Desktop.
How to rename the /admin URL to /newadminpanel on an Elefant CMS website.
<?php
echo preg_replace (
'|([\'"])/admin|',
'\1/newadminpanel',
$data['html']
);
?>
<?php
$_SERVER['REQUEST_URI'] = preg_replace (
'|^/newadminpanel|',
'/admin',
$_SERVER['REQUEST_URI']
);
?>
  1. Rewrite incoming requests by adding bootstrap.php to the document root folder.

  2. Rewrite outgoing data by adding adminrewrite.php to the apps/myapp/handlers folder.

  3. Add the following line to the [Hooks] section in conf/config.php:

     page/render[] = myapp/adminrewrite
    
  4. Using Nginx, add the following to your vhost:

     location ~ ^/admin/?$ {
         error_page 404 /404.html;
     }
    

Using Apache, add the following instead:

RedirectMatch 404 ^\/admin\/?$
@evan70
Copy link

evan70 commented Feb 28, 2014

Fantastic!

@evan70
Copy link

evan70 commented Mar 12, 2014

Rewrite outgoing data by adding adminrewrite.php to the apps/myapp/handlers folder. >

is it /apps/newadminpanel/handlers or all installed apps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment