How to change magento’s base url (Magento1)


A common question that comes up for magento users is how to change magento’s base url.  If you do it wrong you will basically take down your site AND lock yourself out of your admin panel so you can’t change it back.  There are three methods of how to change magento’s base url, in case you mess up and lock yourself out of your admin panel it is a good idea to familiarize yourself with all three methods.

Method 1:  Through the admin panel 

The easiest way to change the url, yet the most dangerous, is through the admin panel itself.  First click on ‘system’ and ‘configuration’ from the top horizontal navigation.

Next Under ‘General’ on the left vertical navigation bar click ‘web’.  You will want to change both the secure and unsecure sections.  Hit Save Config when you are finished.  Like I said if  you mess something up you may block yourself from the site and admin panel and have no other choice but to use one of the methods below.

changeurl 300x203

Method 2: Using phpMyAdmin Another way of how to change Magento’s base url is to open phpMyAdmin and locate your database. Once you have found your database you need to find the ‘core_config_data’ table.  There will be a lot of entries.  At the very top there are entries for web/unsecure/base_url and web/secure/base_url.  All you need to do is change those values to the correct url.  The good news about this method is that it is fool-proof, if you go to the site and it does not work you can go back to phpMyAdmin and keep working on until it does work.

changeurl1 300x207
Method 3: Command line  Some of you like to do all your mysql via the command line. If you don’t have phpMyAdmin or choose not to use it you can use the command line itself as another way of how to change Magento’s base url.

  • you will want to use SSH to log into your database server.
  • enter the following where $database_user  the real user and database_name is the real name:
    • mysql -u $database_user -p $database_name
  • After you enter the correct info you will be prompted for the password
  • to start using the database in question enter ‘use database’ (press enter)
  • Run the following command:
    • select * from core_config_data where path like ‘%base%url%’;
  • This shows you the current base urls which we can change with the following mysql.
    • update core_config_data set value = ‘http://domainname/’ where path = ‘web/unsecure/base_url’; update core_config_data set value = ‘http://domainname/’ where path = ‘web/secure/base_url’;

Note: If you are not familiar with command line this method may not be for you.  But it is another option to look at if you lock yourself out of admin and don’t have phpMyAdmin,

If you find you need expert help on how to change magento’s base url contact Brian Wade at




case studies

See More Case Studies

Contact us

Partner with Us

We’re happy to answer any questions you may have and help you determine which of our services best fit your needs.

Your benefits:
What happens next?

We Schedule a call at your convenience 


We do a discovery and consulting meeting 


We prepare a proposal 

Schedule a Free Consultation
Simplifying IT
for a complex world.
Platform partnerships