inovve

Magento: How to change Admin URL Path?

Dec 16th, 2013
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1. 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.
  2.  
  3. Generally, we do have ‘admin‘ as the administrator path for Magento. So, the admin URL will be http://www.example.com/admin/
  4.  
  5.  
  6. 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/.
  7.  
  8. You can do this from either of the two ways stated below:-
  9.  
  10. 1) Changing local.xml
  11. 2) Changing Admin URL from Magento Backend Admin Settings
  12.  
  13. 1) Changing local.xml
  14. - Open app/etc/local.xml
  15. - Find the following:-
  16.  
  17. <admin>
  18. <routers>
  19. <adminhtml>
  20. <args>
  21. <frontName><![CDATA[admin]]></frontName>
  22. </args>
  23. </adminhtml>
  24. </routers>
  25. </admin>
  26. - Change
  27.  
  28. <frontName><![CDATA[admin]]></frontName>
  29. to your desired name. Like below:-
  30.  
  31. <frontName><![CDATA[backend]]></frontName>
  32. - Save the file
  33. - Refresh the Cache from Magento Admin (System -> Cache Management)
  34.  
  35. Now, you should be able to access admin panel from http://www.example.com/backend/ instead of http://www.example.com/admin/
  36.  
  37. 2) Changing Admin URL from Magento Backend Admin Settings
  38. The other easy way is to change the admin url from Magento backend setting.
  39.  
  40. - Go to System -> Configuration -> ADVANCED -> Admin -> Admin Base URL
  41. - Select Use Custom Admin Path as “Yes”
  42. - Add ‘backend‘ in Custom Admin Path field.
  43. - Now you will be logged out.
  44. - Login again and you can see that your admin url has been changed to http://example.com/index.php/backend/
  45.  
  46. A mistake I made earlier
  47. You can skip this. This is not a necessary step. It is only important, if you have done similar mistake as written below.
  48.  
  49. I tried to change the Admin Base URL from Magento admin panel but had some problem. Here is what I did:-
  50.  
  51. - Go to System -> Configuration -> ADVANCED -> Admin -> Admin Base URL
  52. - Select Use Custom Admin URL as “Yes”
  53. - Add ‘backend/‘ in Custom Admin URL field.
  54.  
  55. 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.
  56.  
  57. The mistake was to change the Custom Admin URL instead of Custom Admin Path.
  58.  
  59. To solve the problem, I had to make database changes. If you had similar problem then here is a workaround:-
  60.  
  61. - Open your database
  62. - Browse table ‘core_config_data‘
  63. - Search in path field for ‘admin/url/custom‘ and set its value to empty
  64. - Search in path field for ‘admin/url/use_custom‘ and set its value to ’0′
  65. - Here is the SQL query:
  66.  
  67. UPDATE core_config_data
  68. SET value = ”
  69. WHERE path = ‘admin/url/custom’;
  70.  
  71. UPDATE core_config_data
  72. SET value = ’0′
  73. WHERE path = ‘admin/url/use_custom’;
  74.  
  75. - Search in path field for ‘web/secure/base_url‘
  76. - You will find two row result. One with scope ‘default’ and another with scope ‘stores’.
  77. - Edit the value of row with scope ‘stores’ with the value of the row with scope ‘default’.
  78.  
  79. UPDATE core_config_data
  80. SET value = (
  81. SELECT value FROM (
  82. SELECT * FROM core_config_data
  83. ) AS ccd
  84. WHERE ccd.path = ‘web/secure/base_url’
  85. AND ccd.scope = ‘default’)
  86. WHERE path = ‘web/secure/base_url’
  87. AND scope = ‘stores’;
  88.  
  89. - Similarly, repeat the process for ‘web/unsecure/base_url‘:-
  90.  
  91. - Search in path field for ‘web/unsecure/base_url‘
  92. - You will find two row result. One with scope ‘default’ and another with scope ‘stores’.
  93. - Edit the value of row with scope ‘stores’ with the value of the row with scope ‘default’.
  94.  
  95. UPDATE core_config_data
  96. SET value = (
  97. SELECT value FROM (
  98. SELECT * FROM core_config_data
  99. ) AS ccd
  100. WHERE ccd.path = ‘web/unsecure/base_url’
  101. AND ccd.scope = ‘default’)
  102. WHERE path = ‘web/unsecure/base_url’
  103. AND scope = ‘stores’;
  104.  
  105. - Now, you will be able to login to Magento admin with your old admin base URL (http://example.com/index.php/admin).
Advertisement
Add Comment
Please, Sign In to add comment