How to change magento admin URL ? why this question comes into mind I can say its because of security issue.Generally for protecting magento backend against hackers we need to change the default URL to our custom URL of Magento backend. By doing this we can add some extra protection layer to our magento backend. You can follow the bellow steps to change admin path or URL.

Step One:

Change by local.xml:

This step is easiest and more reliable for changing magento admin URL. So now open up local.xml file through the dir: app/etc/local.xml with your favorite text editor then search for below code:

before:

<admin>
    <routers>
        <adminhtml>
            <args>
                <frontname>< ![CDATA[admin]]></frontname>
            </args>
        </adminhtml>
    </routers>
</admin>

and change admin to your any custom name like backend. This should be something personal no-one can guess easily and use only letters or number no special characters are allowed then save that file.

After:

<admin>
    <routers>
        <adminhtml>
            <args>
                <frontname>< ![CDATA[backend]]></frontname>
            </args>
        </adminhtml>
    </routers>
</admin>

After doing all these go to var/cache and delete all the content Or you can do this easily through SSH by following command:

rm -rf var/cache/*

Here your controller should be at root directory then your command will work.

Now your old url is gone away and new new url come to that place. You can access this URL http://yourdomain.com/index.php/backend/ instead of this one http://yourdomain.com/index.php/admin/.

  • Old URL: http://yourdomain.com/index.php/admin/dashboard/index/key/81b26388b798a13705f5450865333cad/
  • New URL: http://yourdomain.com/index.php/backend/dashboard/index/key/81b26388b798a13705f5450865333cad/

Step Two:

Change by web interface:

This is another way to change magento admin URL. But I can say some people make sever mistake on this step which creates more difficult to recover the magento URL. So if you are going through this step make your concentration and do what all the setting you will get from below.
Web interface means, by magento admin panel you can change your admin URL. So for this first go admin page and enter all credential and go to dashboard and follow below steps:

  • Go to system => configuration => advanced => admin => admin base URL
  • Set “Use Custom Admin Path” to Yes
  • Enter ‘backend‘ in “Custom Admin Path” field
  • click on save config
  • then you will be logged out and login page will come with http://yourdomain.com/index.php/backend/ instead of http://yourdomain.com/index.php/admin/
  • Now you are DONE with new URL.

Avoid below mistakes:

Some mistake may happen by this step. So please follow the below setting what is the actually mistake can be done with this step. So please don’t do below mistake which won’t allow you to access backend URL and will give 404-not found page.

  • Go to system => configuration => advanced => admin => admin base URL
  • Set “Use Custom Admin URL” to Yes
  • Enter ‘backend‘ in “Custom Admin URL” field
  • click on save config

Resolution if you have done above mistake:

If you do this settings then you backend will not work you have to go phpmyadmin page and need to change some columns of some tables.So please follow the below steps to solve your critical issue.

  • Open up database
  • browse table core_config_data
  • Search in path field “admin/url/custom” and set its ‘value’ field to empty
  • Search in path field “admin/url/use_custom” and set its ‘value’ field to 0

Either you can do by above settings or by belwo 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 for path field “web/secure/base_url
  • You will find two result by one with scope default and on-other with scope stores.
  • Take the content of field ‘value’ with scope = ‘default’ to content of field ‘value’ with scope = ‘stores’

Either you can do by above settings or by below SQL query:

UPDATE `core_config_data` as ccd1 inner join ( SELECT `value` FROM `core_config_data` WHERE `scope` = 'default' AND `path` = 'web/secure/base_url' ) as ccd set ccd1.`value` = ccd.`value` WHERE ccd1.`path` = 'web/secure/base_url' AND ccd1.`scope` = 'stores';

Similarly repeat the process for “web/unsecure/base_url“.

  • Search for path field “web/unsecure/base_url
  • You will find two result by one with scope default and on-other with scope stores.
  • Take the content of field ‘value’ with scope = ‘default’ to content of field ‘value’ with scope = ‘stores’

Either you can do by above settings or by below SQL query:

UPDATE `core_config_data` as ccd1 inner join ( SELECT `value` FROM `core_config_data` WHERE `scope` = 'default' AND `path` = 'web/unsecure/base_url' ) as ccd set ccd1.`value` = ccd.`value` WHERE ccd1.`path` = 'web/unsecure/base_url' AND ccd1.`scope` = 'stores';

Then after you will be able to access your previous URL like: http://yourdomain.com/index.php/admin/

Hope you enjoyed this article How to change magento admin URL and will never forget to share for others.

Thanks for visiting

How to change magento admin URL
Tagged on:             

9 thoughts on “How to change magento admin URL

  • June 30, 2015 at 10:32 am
    Permalink

    thanks alot it really helped

    Reply
  • October 2, 2015 at 2:46 pm
    Permalink

    Thank you for this. I recovered from the database mistake you mentioned.

    Reply
  • November 18, 2015 at 6:50 am
    Permalink

    Very nice article!!

    Keep helping..

    Reply
  • June 10, 2016 at 7:01 pm
    Permalink

    I followed every step explain here but only the Admin Panel part is needed. Change the app/etc/local.xml file doesn’t affect the Admin Panel URL. Obviously I clear the cache everytime, but even I don’t just changing the Custom Admin Path field is enough. I’m using Magento CE 1.9.10.

    Thanks so much for the tutorial, by the way.

    Reply
    • June 10, 2016 at 7:12 pm
      Permalink

      If you are sure that you have set admin URL through step one and clear all cache even custom cache also and not got your solution then just check step two , don’t do step two. I mean if it is already been set from admin panel configuration then it won’t affect through local.xml file. You have set no on admin panel configuration to see local.xml changes.

      Reply
  • December 7, 2016 at 12:58 pm
    Permalink

    Hello I have no database access So please please tell me another solutions how i am fix the issues or put the change admin url change “No”.
    Please reply ASAP

    Reply
    • December 18, 2016 at 6:11 am
      Permalink

      you can run all sql queries through your custom script either in magento root folder an somewhere else.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *