Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento - How to Manually Change Base URL / Domain?

Tags:

magento

I've done searches for this, but can only find answers on how to do this through the admin panel (which I can't reach).

I have a live Magento installation that I'm going to be doing some new development on.

So I'm setting up a development site on a subdomain of the main site's url (http://test.mydomain.com)

The problem I'm having is that somewhere in the Mage::run() bootstrapper, the site's getting redirected to the www subdomain.

I've changed the following 2 records in the DB:

mysql> select * from core_config_data where value like '%mydomain.com%';
| config_id | scope   | scope_id | path                   | value                         |
+-----------+---------+----------+------------------------+-------------------------------+
|         2 | default |        0 | web/unsecure/base_url  | http://test.mydomain.com/     |
|         3 | default |        0 | web/secure/base_url    | http://test.mydomain.com/     |
  • I've also ensured that the 'local.xml' config is pointing to the new dev DB.
  • I've also deleted the entire /var/cache
  • I've also removed all htaccess subdomain redirects
  • I've also restarted Apache.

No luck, still redirecting.

What am I missing?

like image 759
Steven Moseley Avatar asked Nov 25 '12 14:11

Steven Moseley


2 Answers

So it turns out the problem was that Apache didn't have write permissions to the WEBROOT/var directory, so Magento was using its cache from the system /tmp directory. (thanks for the tip, Fiasco Labs!)

In case someone gets here from Google, I'll reiterate the steps...

How to Manually Change Domain in Magento

  1. Update your core_config_data table to edit the two records for web/unsecure/base_url and web/secure/base_url
  2. Delete the contents of WEBROOT/var/cache
  3. Update / edit any .htaccess domain redirects you may have added
  4. Restart Apache
  5. Make sure Apache has write permissions to WEBROOT/var
  6. If you created a new DB, ensure that the WEBROOT/app/etc/local.xml is pointing to it.
  7. If you're using Chrome, clear your browser cache! (Chrome caches 301s)

That's about it. Cheers.

like image 153
Steven Moseley Avatar answered Oct 23 '22 01:10

Steven Moseley


Try to use FLUSHALL command on redis-cli, maybe you have a cached database.

It worked for me.

like image 1
Ilson Nóbrega Avatar answered Oct 23 '22 00:10

Ilson Nóbrega