Magento - Duplicated live site to a development server but it redirects to live site?

Magento - Duplicated live site to a development server but it redirects to live site?

September 5, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Duplicated live site to a development server but it redirects to live site?

Solving Magento Live Site Redirection Issues on a Development Server

Hello Dave,

Thank you for reaching out about your Magento redirection issue. I understand how frustrating this can be, especially after making all the necessary changes from a developer’s perspective. Let me walk you through some potential causes and solutions to get your development site back on track.

Potential Causes of Redirection Issues

There are several reasons why your domain2.com might still be redirecting to domain1.com:

1. Uncleared Cache in the Development Environment

Even after clearing the var/cache and var/session folders, some cache files may remain or be regenerated due to ongoing activity on the development server.

2. Base URL Configuration in the Database

The base URL configuration in your Magento database may still refer to domain1.com, even if you’ve done a global find/replace across all tables.

3. Hardcoded Absolute Paths or URLs

Some core files or extensions might contain hardcoded absolute paths or URLs that are not being replaced by your find/replace operations.

Detailed Solutions to Eliminate the Redirection

Let’s troubleshoot this step-by-step, following my proven approach from years of working with Magento:

1. Reset Cache and Session Folders Again

Double-check that you’ve cleared both var/cache and var/session folders completely. If necessary, delete these directories manually via SSH or FTP.

rm -rf /path/to/your/magento/installation/var/*

2. Verify Base URLs in the Database

Connect to your Magento database using a MySQL client like phpMyAdmin or HeidiSQL. Locate the core_config_data table, which stores all global configuration settings.

Update the base_url and secure_base_url fields for your store view(s) to reflect the new domain2.com URL.

UPDATE core_config_data
SET value = 'https://domain2.com'
WHERE path LIKE '%base_url%';

3. Search for Hardcoded URLs in Core Files

Use a text editor or IDE with grep functionality (like Sublime Text or Visual Studio Code) to search your Magento installation for any occurrences of domain1.com in core files.

grep -r 'domain1.com' /path/to/your/magento/installation/

If you find any hits, update those URLs accordingly and commit the changes to version control.

4. Reset and Reindex Your Development Site

After updating the database and checking for hardcoded URLs, flush your Magento cache one more time:

php bin/magento cache:clean
php bin/magento cache:flush

Then reindex all necessary indexes again to ensure data consistency.

Final Steps for a Clean Development Environment

1. Delete the var/session folder after each session

To avoid caching issues, delete or rename this folder before starting your development sessions and create a new one when needed.

rm -rf /path/to/your/magento/installation/var/session/ && mkdir /path/to/your/magento/installation/var/session/

2. Regularly update your development environment

Make it a habit to keep your local copies up-to-date with the latest Magento patches and security updates from Laravel Company’s official Magento maintenance plans.

Conclusion

Resolving redirection issues between live and development environments requires a combination of database manipulation, file system checks, and proper cache management. By following my detailed approach above, you should be able to eliminate the redirection problem and enjoy a stable Magento development experience on domain2.com.

Remember that thorough testing is crucial before deploying any changes from your development environment back to the live production site. Always backup your database first and test everything extensively in a staging environment if possible.

Let me know if you need further assistance or have any other questions about managing your e-commerce platforms more effectively.

Cache Database Extensions Configuration

Our network