How to change the Magento Admin URL / Path

To protect your Magento backend against hackers and brute-force attacks, we recommend that you change the default URL to the Magento Admin Panel. It is a quick way to add an extra layer of security to your site.

Follow these steps to change the admin URL/path.

Note: Do NOT use the web interface in the Magento Admin Panel to change the admin URL, as this is known to cause severe problems.

Step 1 - Change Path

First, open the local.xml configuration file in your favorite text editor, or use the Text Editor in the cPanel File Manager. The file is usually located in the app/etc/ directory under your Magento installation. Locate the following code segment:

  1. <admin>
  2.   <routers>
  3.     <adminhtml>
  4.       <args>
  5.         <frontName><![CDATA[admin]]></frontName>
  6.       </args>
  7.     </adminhtml>
  8.   </routers>
  9. </admin>

Now, replace admin with your new admin path. This should be something personal which is hard to guess, use only letters or numbers - no special characters, then save the file.

Step 2 - Refresh Cache

The final step is to refresh your cache. Use an FTP client to delete the content of the var/cache/ directory, or use the following SSH command.

(First, navigate to you Magento root directory)

  1. rm -rf var/cache/*

Step 3 - Complete

The change is now complete and you should try to log in via the new admin url - http://yourmagentodomain/adminpath/, replacing 'adminpath' with the path you chose in the step above. If everything went fine, you should now be presented with the Admin Panel login screen at the new URL. The old admin login URL should return a 404 error message.

Was this answer helpful?