-2

Currently to login as an admin I need to navigate to the URL http://drupal.mysite.com/user and then I am logging in with userid admin.

I want to change the user part of the URL to my own custom URL containing customadmin, so that I can navigate to my login page with URL http://drupal.mysite.com/customadmin (instead of URL http://drupal.mysite.com/user).

I know there are some core file that can be changed to do this, like:

'H:\xampp\htdocs\mydrupal\modules\user\user.module'

I.e by modifying the hook menu for login like so:

/**
   * Custom menu for login
   */
  $items['customadmin'] = array(
    'title' => 'User account',
    'title callback' => 'user_menu_title',
    'page callback' => 'user_page',
    'access callback' => TRUE,
    'file' => 'user.pages.inc',
    'weight' => -10,
    'menu_name' => 'user-menu',
  );

But I wonder if there is some other way to do this (instead of making changes in core files, which is not recommended of course).

3
  • I find your question a bit bizar, but not inappropriate. Do not worry too much about downvotes on SE. Rather consider them as opinion epressions. Also note that it does not "cost" any reputation to downvote a question, while downvoting an answer costs -1 to the downvoter. However, a downvote to a question or an answer always costs -2 to the author of the question or answers. So downvoting questions is cheap (at no cost). so why bother? Also: if you only get 1 upvote (like mine ...), it compensates for 5 downvotes (5 * (-2) = -10) ... May 4, 2015 at 23:01
  • 1
    @Pierre.Vriens : Thanks for information and upvote ;)
    – Hitesh
    May 6, 2015 at 6:12
  • You're Welcome! Also at chat.stackexchange.com/rooms/22624/… ... And note 'somebody' also upvoted your comment already ... Right! May 6, 2015 at 6:17

1 Answer 1

8

Do not edit core files (ever).

You can do this without code by setting a path alias for the /user path.

Go to admin/config/search/path/add and add the alias customadmin for existing path user:

enter image description here

Now if you go go to /customadmin you will see the login or user page. If you want to ensure that that the /user path also redirects to /customadmin, just enable the Global Redirect module (no configuration needed).

7
  • Sry for late reply Will settingpath alias disable /user i dnt want them to see login page if they are trying to navigate to /user
    – Hitesh
    Dec 13, 2014 at 6:14
  • Oh got it .....just have to redirect user to custom admin.....thanks
    – Hitesh
    Dec 13, 2014 at 6:21
  • Everything working fine, how do I make /user to show 404 instead of /customadmin whole purpose of this was to hide the adminurl from third person
    – Hitesh
    Dec 13, 2014 at 12:07
  • You could just put a redirect for /user in your .htaccess I suppose. Why would you need to do this? Dec 13, 2014 at 12:10
  • I dnt want others to reach my admin login page....it was to try to make site more secure @autopoietic
    – Hitesh
    Dec 13, 2014 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.