Moved magento site to another host, redirecting to the old site

Moved magento site to another host, redirecting to the old site

September 30, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Moved magento site to another host, redirecting to the old site

Solving Magento Redirect Issues After Migration

Migrating your e-commerce site from one hosting provider to another is a complex task that requires careful attention to detail. One of the most common issues you may encounter after the migration process is redirection back to the old domain.

If you’ve recently moved your Magento site and are experiencing this issue, don’t worry - I’ll guide you through the necessary steps to resolve it effectively.

Understanding the Redirection Problem

The redirection problem usually occurs due to incorrect configurations in the database or the local.xml file. When you move a Magento site, it’s crucial to update these settings accurately on the new host to ensure smooth operation without any redirects.

Let me break down your current scenario and identify the probable cause of the issue:

  1. Database Backup: You mentioned that you’ve successfully backed up the database before the migration. This is a great start as it ensures that all your vital data remains intact during the process.

  2. File Migration: Your files were zipped, copied to the new host, and unzipped without any apparent issues. This suggests that the physical transfer of the site’s components was successful.

  3. Database Update: You’ve updated the secure and unsecure base URLs in your database using the core_config_data table. This is a necessary step to reflect the change of domain on the new host.

  4. Local.xml Update: You’ve modified the local.xml file to point to the correct database name for the new host. This ensures that Magento can connect to the right database when processing requests on the server.

  5. Cache and Session Clearance: Clearing the var/cache, var/tmp, and var/session directories is a best practice after migration to ensure Magento functions optimally with fresh data.

Identifying the Root Cause

Based on your steps, it seems that you’ve covered most of the essential groundwork required for a successful migration. However, there are a few potential areas we need to examine further:

  1. Base URLs Consistency: Ensure that both the secure and unsecure base URLs in your database match exactly with the new domain. Even a single character discrepancy can lead to redirection issues.

  2. Local.xml Verification: Double-check the local.xml file to confirm that all the values are accurate, including the database name, username, password, and host. Any discrepancies here could result in connection errors or redirects.

  3. Indexing Issues: After a migration, it’s not uncommon for Magento’s indexers to go out of sync with the current state of your catalog data. Out-of-date indexers can cause unexpected behavior, including redirects.

  4. SEO URLs: Check if there are any entries in the core_url_rewrite table that still point to the old domain. These redirects may be causing the issue you’re experiencing.

Resolving the Redirection Problem

To resolve this redirection problem effectively, I recommend following these steps:

  1. Verify Base URLs Consistency: In your database, check the core_config_data table’s entries for both secure and unsecure base URLs. Ensure they match exactly with your new domain name.

  2. Re-check Local.xml: Open the local.xml file again and double-check all the values related to your database connection. Make sure there are no typos or inconsistencies in the configuration.

  3. Check Indexers Status: Log into your Magento admin panel, navigate to System > Index Management, and review the status of each indexer. If any are out-of-date or disabled, click “Reindex All” to bring them up-to-date.

  4. Clean the Cache and Session Data: To ensure a fresh start, delete all the files in the var/cache and var/session directories again. This helps remove any cached data that might be causing conflicts with your new domain settings.

  5. Review SEO URLs: Use a MySQL query to check for entries in the core_url_rewrite table that may still point to the old domain:

SELECT * FROM core_url_rewrite WHERE request_path LIKE '%old_domain%';

If you find any entries, update or delete them as appropriate.

Further Troubleshooting Steps

If you’ve followed these steps and are still experiencing redirection issues, consider the following additional troubleshooting measures:

  1. Flush Magento Cache: Use the command php bin/magento cache:flush in your terminal to completely clear all cached data from Magento’s file system.

  2. Check .htaccess File: The .htaccess file plays a crucial role in redirecting URLs based on rewrite rules defined within it. Ensure that there are no conflicting or outdated rules still pointing to the old domain.

  3. Review Robots.txt: Check your robots.txt file to make sure it doesn’t contain any directives that might be causing redirection issues.

  4. Validate Base URLs Again: Use a tool like https://laravelcompany.com/magento-base-url-validation to validate your base URLs and ensure they are configured correctly across all relevant tables in the database.

Conclusion

Migrating a Magento site successfully requires careful attention to detail, especially when it comes to updating domain-related settings. By following the steps outlined above - verifying base URL consistency, re-checking local.xml, ensuring indexers are up-to-date, cleaning cache and session data, and reviewing SEO URLs - you should be able to resolve most redirection issues that arise after a migration.

Remember, patience and thoroughness are key when it comes to troubleshooting these types of problems. Don’t hesitate to seek professional help if the issue persists despite following all the steps above.

At https://laravelcompany.com, we specialize in Magento development and provide expert guidance for migrating your e-commerce sites seamlessly. Contact us today to discuss your project requirements!

Database Configuration Errors

Our network