Monday, September 5

How to change Admin URL Path in Magento

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/

Here is how we do it:-

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

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

- Change

<frontName><![CDATA[admin]]></frontName>

to your desired name. Like below:-

<frontName><![CDATA[backend]]></frontName>

- 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/
Important Note

If you just need to change the admin base URL then the proper way I find is by doing the change in local.xml like explained above, instead of editing configuration setting from admin like said below.

I tried to change the Admin Base URL from Magento admin panel. But, I ran into problem and could not access the admin after that. Here is what I did:-

- System -> Configuration -> ADVANCED -> Admin -> Admin Base URL
- Changed Use Custom Admin URL = Yes
- Changed Custom Admin URL (Once I tried with ‘backend/’ and then with ‘http://www.example.com/backend/’)

To solve the problem, I had to make some change in database. 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/use_custom‘ and set its value to ’0′
- Search in path field for ‘admin/url/custom‘ and set its value to empty

- 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

- Similarly, repeating 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

- Now, you will be able to login to Magento admin with your old admin base URL.

Ref : http://blog.chapagain.com.np/magento-how-to-change-admin-url-path/

1 comment:

  1. Thank you so much you saved me, really on point

    ReplyDelete