1 atavistic Dec 15, 2007 06:43
3 edb Dec 15, 2007 08:36
eazy breazy. Are both domain names hosted at the same place? Doesn't really matter, but if they are it's easy because you probably don't need to actually rebuild the database. Anyway...
Backup your database. Assuming your webhost has cpanel you can use the 'backup' utility to download a copy of your database to your pc. It'll give you something like "whatever.sql.gz" for a file name. You can also use phpmyadmin's 'export' feature, but it's not as easy as backup. It's also much easier to restore from 'backup' than from 'export'.
Now backup all the files on your server. I use Filezilla for my FTP client, but whatever you upload with you can use to download all your files. If you already have a local copy of your files make sure it is complete. Like especially the media folder. And there are some skins and plugins that will create files, so you'll want to give your boyfriend a kiss on the cheek and gently remind him to make sure he gets a backup of anything like that.
Now for the really tricky part: Just kidding. There is no tricky part. Yet ;)
You will need to edit one file to get the deal to go down eventually, but let's get the backups done first. AFTER you have your backups done conf/_basic_config.php will need to be edited so that $baseurl provides the new domain name. Also maybe you'll want to change your email address in the same file? It's not a commonly used email address btw. The email address in your profile is for stuff like message forms. The one in the _basic_config.php file is for stuff like the system itself has to tell you something.
After all this is done you'll need to have the bf clean the kitchen and take out the trash. Transferring domains names is impossible with a messy kitchen. Or change the oil if the kitchen is clean.
When he's done with that it'll be time to restore your web under the new domain. This is when "are you moving to a new host" is an important question, so ... your turn!
4 edb Dec 15, 2007 08:49
Plus you really should consider upgrading to 1.10.3 because it's the rock-solid end of the 1.* generation. Your skin will survive it, and we don't really like to try to remember all the little details that changed each step of the way.
5 atavistic Dec 15, 2007 20:46
EdB wrote:
After all this is done you'll need to have the bf clean the kitchen and take out the trash. Transferring domains names is impossible with a messy kitchen. Or change the oil if the kitchen is clean.
When he's done with that it'll be time to restore your web under the new domain. This is when "are you moving to a new host" is an important question, so ... your turn!
Awesome, my boyfriend LOVES to clean. (No, seriously.)
I'm staying with the same hosting service (HostPC). I'm just switching domains.
I have no media files in B2evo itself. All of my files (/images) are at my domain. I know how to move those from olddomain to newdomain. :) Copy, move. :D I learned that trick by accident one day.
Also, my hosting service has an "installatron" that I've used to install/update B2evo in the past. I can't update due to some funkiness with a restore from a while ago, but I can install version 1.10.3. Should I do that BEFORE I move all the stuff?
If that question made no sense, forgive me, it's 440 am my time.
(BTW, your instructions are super clear, thank you!)
6 afwas Dec 15, 2007 20:51
atavistic wrote:
Also, my hosting service has an "installatron" that I've used to install/update B2evo in the past. I can't update due to some funkiness with a restore from a while ago, but I can install version 1.10.3. Should I do that BEFORE I move all the stuff?
If that question made no sense, forgive me, it's 440 am my time.
(BTW, your instructions are super clear, thank you!)
You must do an update. It doesn't matter if you do it now or after the transfer. Start with making a backup fro the DB.
If you are have problems with an upgrade, that is a totally different matter, but we will help you with that as well.
Good luck
7 edb Dec 16, 2007 00:12
Did you simply add newdomain to the hosting account you have for olddomain? If so you PROBABLY do not need to rebuild your database because your newdomain will be able to reach it.
This is what I would do: after editing the conf/_basic_config.php file as described above, upload all the files to the path you want for newdomain. For example if you want it to show up as "newdomain.com/blogs" you would have to upload all the files to "path_to_new_domain/blogs". By this I mean it might not be 'root/blogs'. Garrrrr
I have multiple domain names on one hosting account. Only one of them is the actual root, but I have b2evolution at "root" level for each domain. On the server my domain2 is technically speaking a folder inside domain1. So for my second domain name I upload files to "domain1/domain2", but it acts like "domain2" when you visit it. My $baseurl for my primary domain is "domain1.com" and my $baseurl for my second domain is "domain2.com". Hope that clarifies...
Anyway upload all the files to the new domain's path and go visit it. It MIGHT actually show you your blog again. If it throws weird errors it might be because you need to rebuild your database for the new domain. My method to do this is cumbersome, but it works for me. I use my cpanel and fantastico to install b2evolution again so I can get a new database built. I then download the NEW conf/_basic_config.php file so I can get the database connection info. I then delete all the new files from the server because I don't need them. I then use phpmyadmin to DROP all the new tables in the new database. NOW I edit my real conf/_basic_config.php file and enter the database connection info from the version that only lasted a few minutes. Confusing? Yeah a little, but it's not that hard when you start to think about "how do the files talk to the database".
At this point you can now use cpanel's 'backup' feature to restore the original database into the fresh database you just made and DROPPED all the tables from. Oh and you will probably have to change the name of "whatever.sql.gz" to match the name of the new database.
The remaining problem you will have is that any images you've included in posts will be pointing to "olddomain.com/media/whatever", which obviously isn't what you want anymore. If you only have a few posts with images or files it is probably easier to edit them from the back office. If you have a lot of them, or just a lot of posts in general and don't want to try to find ALL cases of "olddomain" there is a pretty slick trick you can use in phpmyadmin to find and replace all existing instances of "domain1.com" with "domain2.com".
RECAP:
You backed up your database AND your files.
You edited your conf/_basic_config.php file.
You uploaded your files and tested if it works.
If so you moved on.
If not you figured out it's the database, and restored your old database [*]tables into a database you created for newdomain.
You tested again and (hopefully) it all worked this time.
You realized your images in posts are still pointing to olddomain, so you either edited the posts in the back office or you asked "what was that cool trick?"[/list:u]
By the way upgrading will be easy, but getting moved is probably a higher priority right now. As Afwas-the-Amazing indicated, we'll hook you up with upgrading info as need be.
8 atavistic Dec 16, 2007 02:29
EdB wrote:
Did you simply add newdomain to the hosting account you have for olddomain? If so you PROBABLY do not need to rebuild your database because your newdomain will be able to reach it.
Yes. Bought it, added it, it's propagated and waiting for my wise thoughts. Heh.
If you have a lot of them, or just a lot of posts in general and don't want to try to find ALL cases of "olddomain" there is a pretty slick trick you can use in phpmyadmin to find and replace all existing instances of "domain1.com" with "domain2.com".
"What was that cool trick?"
By the way upgrading will be easy, but getting moved is probably a higher priority right now. As Afwas-the-Amazing indicated, we'll hook you up with upgrading info as need be.
OK, this whole post sort of made my eyes glaze over, but that's OK. I'm going to start doing the other stuff and then wake up the boyfriend when I need him. I'll worry about keeping the 1.9.3 and upgrading afterwards.
Thanks!
9 edb Dec 16, 2007 17:21
Keep 193 until you're happy with the move. Good idea! That's what I did with the last girlfriend :)
The cool trick to do a "find and replace" on your database is best explained by [url=http://www.zimmertech.com/tutorials/php/60/mysql-search-replace-phpmyadmin.php]the source I would try to mimic[/url], so go there and see the real deal.
Yeah I get too wordy sometimes, but to me it's better to make you bypass stuff than assume you know stuff you might not.
Okay: too wordy too often, but the idea is ... ah crap just STFU eh?
10 atavistic Dec 20, 2007 00:55
OK.
I moved the stuff from [url=http://amandashopa.com/b2evolution1/index.php/]old domain[/url] to [url=http://amandatakesoff.com/b2evolution1/index.php/]new domain[/url] and it looks OK to me. I changed that stuff in conf/_basic_config.php file.
It worked first try. I was kind of surprised. So EdB, all of that database table stuff you talked about...I have no idea, I didn't do any of it.
But now, when I post something through OLD OR NEW domain's B2evo admin panel, it shows up on BOTH domains. Is that supposed to happen?
I haven't tried the cool trick yet. I thought newdomain has propagated, but it hadn't, so I had to wait and only noticed this morning that it's working.
11 atavistic Dec 20, 2007 07:03
About that cool trick...
Whoa. I got into a MySQLAdmin panel. That's whole new world I've never seen before.
I am terrified of destroying my whole new world. :D
WHERE am I supposed to enter the string? Am I supposed to put it in
Run SQL query/queries on server "localhost":
And it's supposed to look like this?
UPDATE vars SET value = replace(value, 'newdomain.com', 'olddomain.com')
Do I have this right?
Sorry to ask what's probably an easy question but I have no idea and I'm not afraid to admit it.
12 edb Dec 20, 2007 14:52
Okay move slowly in there!
First do a backup of the database. That way IF something goes wrong it'll be something you can fix.
Oh and yes if olddomain and newdomain are both pointing to the same database then both will show the same content. Your actual stuff (content!) is stored in the database.
Let me tinker with my installation here in a minute or two and I'll get back to you on the click-path to enter that funky query string that replaces everything.
I'm guessing that on newdomain you are not seeing images in posts that you see in olddomain? That is why eventually you need to either edit all posts with images OR do the funky magic query thing.
I'll be back!
13 afwas Dec 20, 2007 15:25
UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring");
Am I having this right? You want to replace olddomain.com by newdomain.com? I think so, newdomain.com is not yet in your database. Then you must switch those two in your query:
UPDATE vars SET value = replace(value, 'olddomain.com', 'newdomain.com')
In general SQL is not very forgiving. If you have a typo it will warn you by throwing an error and exiting the query. If you did this thing wrong, it simply would do nothing, because it cannot find newdomain.com in the database. So, although fumbling with the database is always a tad nervous operation, in fact it's relatively safe and it is especially so if you have a backup of the database.
But let's listen to what SuperGuru EdB has to say.
Good luck
14 atavistic Dec 20, 2007 16:03
EdB wrote:
Okay move slowly in there!
First do a backup of the database. That way IF something goes wrong it'll be something you can fix.
Oh and yes if olddomain and newdomain are both pointing to the same database then both will show the same content. Your actual stuff (content!) is stored in the database.
OK, I thought it might be because the database is all in one place.
Wow, this is sort of like magic. I wish my students' heads were like databases. It would make teaching a lot easier.
I'm guessing that on newdomain you are not seeing images in posts that you see in olddomain? That is why eventually you need to either edit all posts with images OR do the funky magic query thing.
I'll be back!
I am seeing images. BUT I NEED to do the funky magic thing because a) I don't want the images linked back to my olddomain and b) I take a hell of a lot of pictures.
15 atavistic Dec 20, 2007 16:17
Afwas wrote:
So, although fumbling with the database is always a tad nervous operation, in fact it's relatively safe and it is especially so if you have a backup of the database.
But let's listen to what SuperGuru EdB has to say.
Good luck
I've got so many backups I'm not sure what to do with them. ;)
16 edb Dec 20, 2007 18:24
Okay this is gonna get a bit tricky, so for sure do the cpanel backup thing first. Else, well, else you might do something then say "oops" and have no way out. Maybe no way out. Dunno, but a backup will always let you restore to the point before you did something you regret.
As to editing all your posts at the same time, watch this!
First visit one of the posts from newdomain.com that has something pointing to olddomain.com. A picture will be a perfect example because it typically means you have something like
<img src="http://olddomain.com/media/whatever/image_name.jpg>
in it. We want to get that to point to newdomain.com, but only for things that are images! We don't want TEXT that says olddomain.com to become newdomain.com - yet. You MIGHT want that, but let's pretend for now you only want your images to update to newdomain.com so that when olddomain.com dies your images won't.
So let's take a quick look at the magic special doodad:
UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring");
The first bit we have to have under control is the tablefield thing. For b2evolution POSTS this will typically convert to "evo_posts". You've seen your phpmyadmin thing, so you know if your prefix is "evo_" or not. Everything else I write here will assume you have evo_ and you simply tweak as need be.
The first screen I see in phpmyadmin lets me select a database because I have many of them. So I select the database I want. It is possible that if you have only one it goes straight to it. In that case you didn't have to select it eh? Anyway as soon as I have the main body of the page showing a bunch of tables in a database I ALSO see that I have some options across the top of the page, so I select "SQL". This gives me, and you, the chance to do a MySQL instruction directly on the entire database. Cool eh?
Now I have to properly build my instruction, so let's do it. I think we already figured out "tablename" is evo_posts. I could be wrong because I have 220 instead of 193, but memory tells me "evo_posts" is the thing you're looking for. If it's not there stop and we'll figure it out.
Next I need to have my "tablefield" value figured out. Again I go my memory, but it should be something like "post_content". That would be the actual content in your posts. So far so good.
Now we need to know what we will use for "findstring" and "replacestring". You could go with "olddomain.com" and "newdomain.com" but that will get ALL instances of olddomain.com instead of just the ones for image tags. So maybe you want to use "olddomain.com/media" and "newdomain.com/media"? That will be more specific, meaning if you linked text to your old domain name it won't get captured and updated.
Anyway we now have enough to build your custom SQL statement. Something like this:
UPDATE evo_posts SET post_content = replace(post_content,"olddomain.com/media","newdomain.com/media");
Be sure you have a backup first!
OT: minds are so much better than databases!!! Could you imagine what a crappy planet we would have if everyone processed data the same way everyone else did? No one would ever bother asking why the sky is blue of if the earth is really flat eh? I'm totally into people coming up with the most bizarre questions imaginable because *thinking* leads to laughing.
17 atavistic Dec 21, 2007 00:03
IT WORKED IT WORKED IT WORKED IT WORKED!
I'm bouncing up and down on my couch and my boyfriend (who has not helped me once, see EdB, you're like my B2evo boyfriend) said, "You're a genius."
Now, if I want to replace ALL olddomain.coms (like, for instance links within my own site that point back to B2evo) I would do this?:
UPDATE evo_posts SET post_content = replace(post_content,"olddomain.com/b2evolution1","newdomain.com/b2evolution1");
Do I have that right?
It just replaced 83 lines.
It worked! I didn't break anything! :D
THANK YOU!
This is the thread you are looking for: http://manual.b2evolution.net/Move_my_installation.
Good luck