zoukankan      html  css  js  c++  java
  • [Drupal] How to change the admin url from /admin to /config in Drupal 6.x

    Change the URL for the admin panel: /admin/ will be no more accessible. The goal is to avoid hacks.

    Let say we want to change the entry of backend from /admin to /config, that is the web user is deny when visit http://www.example.com/admin, but allow to visit http://www.example.com/config

    1. Modify the settings.php add the code to the end of this file :

    代码
    /**
    *
    * Change the admin link from /admin to /config
    *
    */
    function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
    global
    $user;

    if (preg_match('|^admin(/.*)|', $path, $matches)) {
    $path = 'config'. $matches[1];
    }
    if ($path == 'admin') {
    $path = 'config';
    }
    if (preg_match('|^user(/.*)|', $path, $matches)) {
    $path = 'usr'. $matches[1];
    }
    if ($path == 'user') {
    $path = 'usr';
    }
    }

    function custom_url_rewrite_inbound(&$result, $path, $path_language) {
    global
    $user;



    if (preg_match('|^config(/.*)|', $path, $matches)) {
    $result = 'admin'. $matches[1];
    }
    if ($path == 'config') {
    $result = 'admin';
    }
    if (preg_match('|^usr(/.*)|', $path, $matches)) {
    $result = 'user'. $matches[1];
    }
    if ($path == 'usr') {
    $result = 'user';
    }

    if ($path == 'admin') {
    $result = '404';
    }

    if (preg_match('|^admin(/.*)|', $path, $matches)) {
    $result = '404';
    }
    }

  • 相关阅读:
    spring无法接收上传文件
    springcloud feign增加熔断器Hystrix
    mybatis调用存储过程(@Select方式)
    spring在注解标注的方法上加切面
    java注解Annotation
    java包装类
    JZ-C-43
    JZ-C-42-Plus
    JZ-C-42
    JZ-C-41-Plus
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/1822415.html
Copyright © 2011-2022 走看看