http://magento.local reverts to live site - Magento and Xampp for OSX

http://magento.local reverts to live site - Magento and Xampp for OSX

October 4, 2026 · Illustrated author avatarBy Stefan Bogdanescu
http://magento.local reverts to live site - Magento and Xampp for OSX

Reverting Your Magento Local Site from Live URL

You’re not alone if you’ve found yourself struggling to get your local Magento development environment working correctly after an update or reinstall. The issue of the site reverting back to the live URL is a common one, but with some careful steps, it can be resolved.

Understanding the Problem

When you installed XAMPP and set up your local environment, you likely configured the base_url and secure_base_url settings in your Magento configuration file to point to “http://magento.local”. However, if these URLs don’t resolve correctly (or at all), Magento falls back to using the live site URL stored in cookies or session variables.

Resolving Your Issue

To fix this problem, you’ll need to take a few steps:

  1. Check Your Hosts File Make sure that your hosts file is properly configured for “magento.local”. On OSX, the hosts file can be found at /etc/hosts. It should contain an entry like:
127.0.0.1    magento.local
  1. Flush Your Cache Even after deleting your cache manually, some session and cookie data may persist. To ensure a fresh start:

    Open a terminal and navigate to your project root directory (the htdocs folder). Run the following commands:

    php maintenance/clean.php
    rm -rf var/cache/*
    rm -rf var/session/*
    
  2. Check Your Configuration Files Open the app/etc/local.xml file in a text editor. Ensure that both base_url and secure_base_url are set to “http://magento.local”:

<base_url>http://magento.local</base_url>
<secure_base_url>https://magento.local</secure_base_url>
  1. Check Your Cookie Domain In the same local.xml file, find the cookie_domain setting:
<cookie_domain>magento.local</cookie_domain>

This should match your local domain exactly.

  1. Clear Browser Cookies and Cache Your browser may be holding onto old cookie and cache data from the live site. Clear these out completely (not just for one domain).

Preventing Future Issues

To prevent this problem in the future, consider a few best practices:

  • Always keep your local environment separate from your development/live sites.
  • Use a dedicated MySQL or PostgreSQL database for each environment.
  • Don’t share the same app/etc/local.xml file across environments. Each site should have its own configuration.

Conclusion

Remember that Magento is a robust platform, but it requires careful configuration to work properly in different environments. By following these steps and maintaining best practices, you can ensure your local development environment stays separate from your live sites.

Don’t forget to check out Laravel Company for more advanced tips on Magento development and how to optimize your workflow.

Cache Configuration Errors

Our network