Home » Magento27 June 2011

Magento: How to change Admin URL Path?

Here is a quick guide on how to change admin url path in Magento. This need to be done for security reason to be safe from hacking/cracking issue. Basically, this is done not to let any general user to access the admin page.

Generally, we do have ‘admin‘ as the administrator path for Magento. So, the admin URL will be http://www.example.com/admin/

This article will show you, how you can change the admin url. Let’s say from ‘admin‘ to ‘backend‘. So, the new admin URL will be http://www.example.com/backend/.

You can do this from either of the two ways stated below:-

1) Changing local.xml
2) Changing Admin URL from Magento Backend Admin Settings

1) Changing local.xml

– Open app/etc/local.xml
– Find the following:-

– Change to your desired name. Like:-

– Save the file
– Refresh the Cache from Magento Admin (System -> Cache Management)

Now, you should be able to access admin panel from http://www.example.com/backend/ instead of http://www.example.com/admin/

2) Changing Admin URL from Magento Backend Admin Settings

The other easy way is to change the admin url from Magento backend setting.

– Go to System -> Configuration -> ADVANCED -> Admin -> Admin Base URL
– Select Use Custom Admin Path as “Yes”
– Add ‘backend‘ in Custom Admin Path field.
– Now you will be logged out.
– Login again and you can see that your admin url has been changed to http://example.com/index.php/backend/

A mistake I made earlier

You can skip this. This is not a necessary step. It is only important, if you have done similar mistake as written below.

I tried to change the Admin Base URL from Magento admin panel but had some problem. Here is what I did:-

– Go to System -> Configuration -> ADVANCED -> Admin -> Admin Base URL
– Select Use Custom Admin URL as “Yes”
– Add ‘backend/‘ in Custom Admin URL field.

While doing so, I had a problem. I could not access the admin path now. My changed admin path should be http://example.com/backend/ or http://example.com/index.php/backend/. But, I was not able to access the path.

The mistake was to change the Custom Admin URL instead of Custom Admin Path.

To solve the problem, I had to make database changes. If you had similar problem then here is a workaround:-

– Open your database
– Browse table ‘core_config_data
– Search in path field for ‘admin/url/custom‘ and set its value to empty
– Search in path field for ‘admin/url/use_custom‘ and set its value to ‘0’
– Here is the SQL query:

UPDATE core_config_data
SET value = ”
WHERE path = ‘admin/url/custom’;

UPDATE core_config_data
SET value = ‘0’
WHERE path = ‘admin/url/use_custom’;

– Search in path field for ‘web/secure/base_url
– You will find two row result. One with scope ‘default’ and another with scope ‘stores’.
– Edit the value of row with scope ‘stores’ with the value of the row with scope ‘default’.

UPDATE core_config_data
SET value = (
SELECT value FROM (
SELECT * FROM core_config_data
) AS ccd
WHERE ccd.path = ‘web/secure/base_url’
AND ccd.scope = ‘default’)
WHERE path = ‘web/secure/base_url’
AND scope = ‘stores’;

– Similarly, repeat the process for ‘web/unsecure/base_url‘:-

– Search in path field for ‘web/unsecure/base_url
– You will find two row result. One with scope ‘default’ and another with scope ‘stores’.
– Edit the value of row with scope ‘stores’ with the value of the row with scope ‘default’.

UPDATE core_config_data
SET value = (
SELECT value FROM (
SELECT * FROM core_config_data
) AS ccd
WHERE ccd.path = ‘web/unsecure/base_url’
AND ccd.scope = ‘default’)
WHERE path = ‘web/unsecure/base_url’
AND scope = ‘stores’;

– Now, you will be able to login to Magento admin with your old admin base URL (http://example.com/index.php/admin).

Hope this helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Haffouztn

    thanks a lot, it is very helpful

  • OnCar

    your post is nice. Time saver for me.

    OnCar

  • ravisoni6262

    Nice post

  • Mohammed Nabeel

    I have a much better case.

    I have never setup php. so that way i dont think it makes sense to go to phpmyadmin. I have changed the admin url from System -> Configuration -> ADVANCED -> Admin -> Admin Base URL. Please help. i tried changing the line on the xml file and putting it back. I even cleared the cache.

  • If you made mistake with “Admin base url” and correct it with this instruction (through direct changes options in db), you can get error on login like:

    “Exception printing is disabled by default for security reasons.”

    If it’s so just clear the cache ( delete all folders in /magento-folder/var/cache/*) before login.

    Hope this helps.

  • DC

    I followed your instructions but cannot log into my magento account?

  • Marcos Koshino

    Thaaaanks! :DDD saved my life!

  • SAGIR AZAM

    Thanks a lot. Very Helpful…

  • Help

    I have the same issue and can’t login to my admin panel but the problem is I can’t even locate my files since developer who built our website is no longer here

  • Help

    Can you help me with it ? please

  • ⓋⒶⒾⒹⒶ

    Very useful thanks! I used the backend option to change url and was locked out from admin.
    I used your database rescue option and im in!!!!! O/ ..i did the last step bit different.

    i dropped extra tables ‘web/unsecure/base_url‘ and ‘web/secure/base_url‘

    from the database :). worked too

    cheers :)

  • rajesh Nautiyal

    In my setup admin url changed through local.xml file. Now admin should be accessible through “domainname.com/customadminurl”
    But,my admin urls are accessible through “domainname.com/admin/customadminurl”.
    Why this admin is coming in url. I have checked all things. I am not able to figure out, why this extra admin is coming with admin url. Please help me.

  • rajesh Nautiyal

    Please respond, if anybody have any idea about this problem.