How to Change Your Joomla Administrator Folder

EDIT:  This page was updated on 8/29/2013 per some forums posts indicating I missed a <?php in a command below.

One thing that is a bit of an issue for Joomla pages is the fact that your administrator folder is not easily changed.  Well, it certainly would be nice if there was a feature in the Global Configuration that allowed to easily change your Joomla administrator URL, but it isn’t available.

There is a way that it can be done so it doesn’t upset your other 3rd-party components and plugins.

Previously I went into the includes/define.php and administrator/includes/define.php files and changed the administrator folder there – then renamed the folder to something else.  But after doing so, I saw this error on a page:

The configuration file for VirtueMart is missing!

It should be here: /administrator/components/com_virtuemart/virtuemart.cfg.php

So, I had to revert everything back to how it was.  Then I stumbled upon another way to rename the Joomla administrator folder – and it works well.

However, this method requires you to rename your htaccess.txt file to .htaccess.  Basically what this does – is it sets up a cookie and then it lets you access the administrator folder.  Without the cookie, you’ll get a 404 error if you attempt to access the Joomla administrator folder.

So first – make a new directory in the root of your Joomla installation (where your administrator, includes, components, modules, and other folders are).  Name it to the folder that you want to use to access your admin site.  So if you wanted to access your Joomla administrator directory using “joomla_admin”, then you would make a new folder called “joomla_admin”.

Now, go into the folder and create an “index.php” file and copy this contents into it:

<?php
$admin_cookie_code=”192837465“;
setcookie(“JoomlaAdminSession”,$admin_cookie_code,0,”/”);
header(“Location: /administrator/index.php”);
?>

Now save that file.

The next step is to add some rewrite rules to your .htaccess file.  Copy this code and add it somewhere in the .htaccess file in your main Joomla install directory; it can be placed right at the bottom if you desire:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/administrator
RewriteCond %{HTTP_COOKIE} !JoomlaAdminSession=192837465
RewriteRule .* – [L,F]

Note the numbers in the bold text.  You can change this to another number if you’d like – but you MUST ensure that the number is the same in both files.

Now – try to go to your site’s administrator page.  You’ll get a 404 error.  But, if you then type in the new folder path (such as “joomla_admin” as specified above), you will then be redirected to the administrator page – and this time it works!

6 thoughts on “How to Change Your Joomla Administrator Folder

  1. would this work converting from an install on easyphp and moved to a linux host which also provides a simplescripts updating service?

    e.g would cookies work that way?

    and would auto-upgrade of joomla fail via inbuilt or simplescripts?

  2. I’m not sure if it will work with Simple Scripts or not.

    Simple Scripts simply installs the Joomla system into your web hosting account. After it is installed, you should be able to go modify as per the instructions above.

    As for an auto-upgrade – yes, that would fail because the admin folder would have been renamed at that point. So that functionality won’t work if you change the admin folder name.

Leave a Comment