[support] setting.php - changing Drupal's admin path
Ron Mahon
ron at inmrc.com
Thu Feb 2 15:50:32 UTC 2006
Rob in that cast it a very good reason to use a subdirectory. Ie
http:/www.yourdomain/drupal/
Making changes to the code always come back and bites you in a--.
This is very simple to do. Just use the full name in the base
/**
* Base URL:
*
* The URL of your website's main page. It is not allowed to have
* a trailing slash; Drupal will add it for you.
*/
$base_url = 'http://yourdomain/drupal';
/**
Don't use localhost
If you have a problem with secondary, pages loading, change the .htaccess
statement to reflect the new path.
Regards
Ron
http://inmrc.com
-----Original Message-----
From: dir.dev at digitalreef.net [mailto:dir.dev at digitalreef.net]
Sent: Wednesday, February 01, 2006 8:04 AM
To: support at drupal.org
Subject: RE: [support] setting.php - changing Drupal's admin path
> Op woensdag 1 februari 2006 11:07, schreef RobiW:
>> I have a similar problem and the reason is that our ISP provides
>> administrative features like stats, spam control etc with the url using
>> www.mydomain.co.uk/admin which conflicts with Drupal admin feature and I
>> have not been able to find any way to change it in Drupal.
>>
>> Havn't found a way round it yet!
Hey Rob -
If you are willing to make some changes to your Drupal
modules/user.module, you can change the URL for the Drupal admin
functions. Here's the relevant section (from ver 4.6.5):
//admin pages
$items[] = array('path' => 'admin/user', 'title' => t('users'),
'callback' => 'user_admin', 'access' => $admin_access);
$items[] = array('path' => 'admin/user/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/user/create', 'title' => t('add
user'),
'callback' => 'user_admin', 'access' => $admin_access,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/user/configure', 'title' =>
t('configure'),
'callback' => 'user_configure', 'access' => $admin_access,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/access', 'title' => t('access
control'),
'callback' => 'user_admin_perm', 'access' => $admin_access);
$items[] = array('path' => 'admin/access/permissions', 'title' =>
t('permissions'),
'callback' => 'user_admin_perm', 'access' => $admin_access,
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/access/roles', 'title' => t('roles'),
'callback' => 'user_admin_role', 'access' => $admin_access,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/access/roles/edit', 'title' =>
t('edit role'),
'callback' => 'user_admin_role', 'access' => $admin_access,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/access/rules', 'title' => t('account
rules'),
'callback' => 'user_admin_access', 'access' => $admin_access,
'type' => MENU_LOCAL_TASK, 'weight' => 10);
$items[] = array('path' => 'admin/access/rules/list', 'title' =>
t('list'),
'access' => $admin_access, 'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10);
$items[] = array('path' => 'admin/access/rules/add', 'title' => t('add
rule'),
'callback' => 'user_admin_access_add', 'access' => $admin_access,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/access/rules/check', 'title' =>
t('check rules'),
'callback' => 'user_admin_access_check', 'access' => $admin_access,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/access/rules/edit', 'title' =>
t('edit rule'),
'callback' => 'user_admin_access_edit', 'access' => $admin_access,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/access/rules/delete', 'title' =>
t('delete rule'),
'callback' => 'user_admin_access_delete', 'access' => $admin_access,
'type' => MENU_CALLBACK);
if (module_exist('search')) {
$items[] = array('path' => 'admin/user/search', 'title' =>
t('search'),
'callback' => 'user_admin', 'access' => $admin_access,
'type' => MENU_LOCAL_TASK);
}
- - - - -
If you change all of the instances of "admin/" (in the "'path' =>"
sections) to something like "dru_admin/" in the above code segment of your
user.module, all the access URL's will change. I'm pretty sure all of the
form-post actions will update as well, as will the menu links in the
administer menu... that's the beauty of the structure of Drupal. Oh - one
more thing: the menus are cached in Drupal, so changing the code probably
won't affect the site immediately. I think logging out and back in may
refresh the menu cache, or quitting the browser and coming back in to init
a new session.
I haven't actually tested changing the admin paths, and perhaps Ber can
comment on any concerns this change might raise... but this method may be
one way around your ISP-imposed directory names.
Cheers,
--Katin
More information about the support
mailing list