Sometimes it may be essential to change the BASE URL of Magento.
(Usually when you want to make a similar copy of Magento on another server!)
There are 2 – 3 simple steps involved in this:
Step 1: Edit old URL values in database
Table: core_config_data
In this table you need to edit the field named value containing specific values in the field named path!
Precisely saying you need to search for web/unsecure/base_url and web/secure/base_url and replace them with new values.
Please refer the images for an example.
OLD Values:
Step 2: Login to backend and clear Configuration cache!
This might be simply not possible and hence skip to next step!
Step 3: Find All entries of old domain name in the cache folder and replace them one by one.
Magento retains all configuration cache in /var/cache folder.
This step is good for Advanced Users who can do file search and replace such strings in one shot 😉
If you are migrating a very big site, then this step will be certainly worth.
I use this “Unix Find Command” very useful in searching:
find . -exec grep -q www.magdummy.cws '{}' \; –print
Step 3: Now it’s time to clear the cache! (Normal User)
As already specified in step2, we know that Magento retains all configuration cache in /var/cache folder.
You can clear the entire contents in this cache folder. Magento regenerates all these files when needed.
Step4: View your new site in the browser.
It should now be working fine like the old one 😉
I hope this would work fine for you.
Please leave your comments or I would appreciate any idea that suits best in this case.
Also make sure that you don’t limit your rows to 30 visible in php – that was my mistake to start with – if you make all rows visible in core_config_data you will see the column
Please make sure you are looking at the right table. There are so many tables in magento, and it is easy to miss the one that is needed! The table named “core_config_data” is what should interest you.
I am using magento 1.4.1.1. I wanted to change base url but in the table there was no such column. Can you please help?
Hi there,
You really save my life.
My site instantly goes complete down when i change myself to
try to see what happens by changing base_url.
I found your help and change it in directly database.
YOU SAVED MY LIFE.
YOU SAVED MY LIFE.
I AM VERY THANKFUL FOR YOUR THIS SITE HELP.
BEST WISHES.
works for me too! thank you so much bro!
I unable to log in to my admin..and my front end is also not looking like same as previous…..please help me out…admin login show in address bar http://magentosite url/admin/dashboard/index/key/48a34f2216dc9d56384b78617ccef9aa/….its showing page not found error
On svn installation I had to preg_replace on some pear configs…
enjoy the ride …
Thanks, this worked brilliantly, although I needed to change the name of the directory into which I installed magento. (This was not mentioned in the description above, but is an important step for it to work. :))
And without the captcha I lost all my entered data, I’m so happy I wrote this twice.
Lazzo – thanks for that hint. None of the migration instructions I have seen so far even mention this. This is a very necessary step, and without it Magento Connect Manager shows up no packages available.
— Jason
After changeing URL i had some trouble with wrong path in /downloader/pearlib/pear.ini, this caused Magento Connect to install extension in the “old” directory.
I did the following to solve this problem:
1) Take a backup of the file /downloader/pearlib/pear.ini
2) Delete (or rename) pear.ini
3) Go to Magento connect manager – the settings are resteted back to “stable”, change it to beta and press save. A new pear.ini file should now be created with the correct path.
4) Done
Good luck!
Thanks man, worked without a problem.
I had disabled the cache in the back-end system/cache-management before renaming, so I could go directly from step 1 to step 4.
This saves a lot of work!
Thanks, worked great !
Douglas, That is great.
I am quite happy that this has been quite useful.
Thanks for all your comments.
Excellent Magento “how-to”. Like Vicky, I just used steps 1 and 4 and it worked great.
Thanks!
Video would be nice to see how to do that.
Hi I am so glad that you all found it useful 🙂
thanks for the easy to follow explanation. It worked like a charm. I skipped steps 2-3 and went to 4.
I change the {{base url}} from admin page in my college textbooks online bookstore.
from http://www.cocomartini.com/bookstore/
to http://www.cocomartini.com/bookstore/collegetextbooks/
now i am not able to login admin again
Hello I changed the {{base url}} for my online bookstore and I can not change it back. I can not connect to admin area either.
Can you please help me?
Hi Serena,
I believe you changed the URLs through the database.
After changing the URLs kindly ensure that you cleared the cache folders.
Regards,
Prakash