Change base URL of Magento

Change base URL of Magento

October 11, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Change base URL of Magento

Changing the Base URL of Magento for Your New Server

Migration of your Magento store from one server to another involves careful coordination to ensure the process doesn’t disrupt your operations or data integrity. If you’ve moved your files but are still being redirected to the old server, this guide will help you resolve the issue and update the base URL.

Understanding the Base URL in Magento

The base URL is used across various parts of your store—from links to CSS and JavaScript files to customer login URLs and email notifications. It’s crucial that all these references point to the correct server where you’ve deployed your new installation.

Changing the Base URL in Your Database

  1. Locate Your Database: First, identify which database is being used by your Magento store on both servers. You can find this information in your index.php file or by checking the db_name, username, and password in the app/etc/local.xml file.

  2. Update the Base URL: Connect to your new server’s MySQL database using a service like phpMyAdmin or directly through a command line client like MySQL Workbench.

    In the Magento Core_Config table, look for the following record:

    path: /web/unsecure/base_url
    value: http://123.456.10.129/
    

    Update the value field to your new server’s address:

    UPDATE Core_Config SET value='http://123.456.241.82/' WHERE path='/web/unsecure/base_url';
    

    Similarly, update the secure base URL record (path: /web/secure/base_url).

Changing the Base URL in Your Code

While updating the database is sufficient for most cases, you may need to update some hardcoded URLs in your custom themes or modules. Look for instances where the base URL has been manually defined and replace them with your new address.

For example, if you have a file app/design/frontend/base/default/template/page/html/header.phtml, search for lines like:

$baseUrl = 'http://123.456.10.129/';

And update them to:

$baseUrl = 'http://123.456.241.82/';

Clearing Cache and Reindexing

After making these changes, clear your Magento cache by running the following commands in a terminal (assuming you have SSH access):

cd /path/to/your/magento/installation/
php bin/magento cache:clean
php bin/magento indexer:reindex

Conclusion: A Smooth Transition with Your Database

Changing the base URL of Magento involves database and code modifications, but it’s achievable without having to create a new database. By carefully following these steps and ensuring your files are properly migrated, you can transition your store to a new server while keeping your existing customer data intact.

Remember, always backup your database before making any changes to prevent potential data loss. If you’re unsure about any part of the process, don’t hesitate to consult with a professional Magento developer or reach out to the support team at Laravel Company.

Happy migrations!

Database Themes Admin Configuration

Our network