How to rename administrator folder in Joomla 3.xx

I can think of at least two reasons for one wanting to change path name to the administrator folder of their Joomla website. Firstly, it’s a good way to trick hackers, which, not being able to find a way to the backend login form, won’t be able to brute force the password. Another reason is more about rapid development than security.

Let’s see, in the last few years Joomla has become a nearly ideal tool to prototype and build the backend of any web-based system. With its built-in ACL subsystem, form builders, and media manager you can quickly create an online application with user access restricted to only the forms you’ve designed for the application. The rest of Joomla settings won’t be accessible, nor visible to them, which makes using the administrator’s backend as a backend for users of your website not a bad idea. But… The users still have to access the backend via the hardcoded /administrator/ path. Which may not be acceptable for some of the projects and is still a bold hint for some of the hackish users.

To my surprise, as of June 2013 there still is no easy way to rename the administrator folder in Joomla 3.xx. There should have been one single setting which would have controlled that. Not now, unfortunatelly. You still have to mess with the core code, and here’s how you do it in 11 simple steps.

1. First of all, please rename your /administrator/ folder to something else. I will use “yourpath” name in my example below.

2. In yourpath/components/com_categories/views/categories/view.html.php replace this

124
125
// Load specific css component
		JHtml::_('stylesheet', $component.'/administrator/categories.css', array(), true);

with that:

124
125
// Load specific css component
		JHtml::_('stylesheet', $component.'/yourpath/categories.css', array(), true);

3. In yourpath/components/com_categories/views/category/view.html.php replace this

109
110
// Load specific css component
JHtml::_('stylesheet', $component.'/administrator/categories.css', array(), true);

with

109
110
// Load specific css component
JHtml::_('stylesheet', $component.'/yourpath/categories.css', array(), true);

4. In yourname/components/com_joomlaupdate/restore.php

replace

4974
4975
4976
// In restore.php mode we have to exclude some more files
$config['skip_files'][] = 'administrator/components/com_akeeba/restore.php';
$config['skip_files'][] = 'administrator/components/com_akeeba/restoration.php';

with

4974
4975
4976
// In restore.php mode we have to exclude some more files
$config['skip_files'][] = 'yourpath/components/com_akeeba/restore.php';
$config['skip_files'][] = 'yourpath/components/com_akeeba/restoration.php';

5. In yourpath/components/com_menus/models/item.php

replace

991
992
// We don't have a component. Load the form XML to get the help path
$xmlFile = JPath::find(JPATH_ROOT . '/administrator/components/com_menus/models/forms', 'item_' . $type . '.xml');

with

991
992
// We don't have a component. Load the form XML to get the help path
$xmlFile = JPath::find(JPATH_ROOT . '/yourpath/components/com_menus/models/forms', 'item_' . $type . '.xml');

6. In yourpath/components/com_messages/models/message.php

replace

315
$siteURL = JURI::root() . 'administrator/index.php?option=com_messages&view=message&message_id='.$table->message_id;

with

315
$siteURL = JURI::root() . 'yourpath/index.php?option=com_messages&view=message&message_id='.$table->message_id;

7. In yourname/components/com_templates/helpers/html/templates.php

replace

27
$baseUrl = ($clientId == 0) ? JUri::root(true) : JUri::root(true).'/administrator';

with

27
$baseUrl = ($clientId == 0) ? JUri::root(true) : JUri::root(true).'/yourpath';

8. In yourname/includes/application.php

replace

36
37
//Set the root in the URI based on the application name
JURI::root(null, str_ireplace('/'.($this->getName() == 'administrator' ? 'distributor' : $this->getName()), '', JURI::base(true)));

with

36
37
//Set the root in the URI based on the application name
JURI::root(null, str_ireplace('/'.$this->getName(), '', JURI::base(true)));

9. In yourpath/includes/defines.php

replace

20
define('JPATH_ADMINISTRATOR', JPATH_ROOT . '/administrator');

with

20
define('JPATH_ADMINISTRATOR', JPATH_ROOT . '/yourpath');

10. In includes/defines.php

replace

24
define('JPATH_ADMINISTRATOR', JPATH_ROOT . '/administrator');

with

24
define('JPATH_ADMINISTRATOR', JPATH_ROOT . '/yourpath');

11. In libraries/joomla/uri/uri.php

replace

238
self::$base['path'] .= '/administrator';

with

238
self::$base['path'] .= '/yourpath';

That’s it! You can now log in at http://yoursite.com/yourpath and enjoy the new pathname of your Joomla backend!

Discuss