Rename Admin Paths (administration)

The purpose of this module is to secure drupal backend by overriding admin path.

Overview

This module allows you to:

  • rename path like '/admin/...' to '/something/...'
  • rename path like '/user/..' to '/something else/..'

It can be effective against registration spam bots or malicious people.

If another module is no longer functional after this module is enabled this usually means that the other module uses hard coded paths instead of paths generated by the router with a route name. This is not something that can and should by fixed by this module.

Drupal 8 / 9

A settings form allows to choose replacement term for "admin" and "user".

8.x-2.x
From now on the module uses the route rebuild event instead of hooks to create routes. The big advantage is that it's no longer has a performance impact on every request and this makes it easier to debug. The routes are cached with the renamed admin paths.

8.x-1.x
This small module just implements hook_outbound_alter and hook_inbound_alter to rename paths.

Drupal 7

Version 7.x-2.x supports Overlay module, but you can get one 404 error only when enable/disable this module with overlay.

Drupal 6

If you are using Drupal 6, you can get the same feature by using the following code in your settings.php file.

function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
    if (preg_match('|^admin(?![^/])(.*)|', $path, $matches)) {
        $path = 'backend'. $matches[1];
    }
}
 
function custom_url_rewrite_inbound(&$result, $path, $path_language) {
    if (preg_match('|^backend(?![^/])(.*)|', $path, $matches)) {
        $result = 'admin'. $matches[1];
    }
    if (preg_match('|^admin(?![^/])(.*)|', $path, $matches)) {
        $result = '404'. $matches[1];
    }
}

Known Issues

Hardcoded links in templates/javascript will break. The solution is to create an issue for those modules (or provide a patch for it) so they can fix it. Another issue is the "views" module not supporting routes but uses hardcoded paths instead. A solution for this would be to change the path in the views config.

Credits

This module was developped at X-PRIME GROUPE, maintained 2 years at Makina Corpus & Acolad Développement and is now maintained at MediaMonks.

Supporting organizations: 

Project information

Releases