January 21, 2013, 4:00 am

Moving Our WordPress Websites

by: Silent Partner    Category: Blogging
email this postEmail This Post Print This PostPrint This Post Post a CommentPost a Comment

Last week, I discussed how and why I had finally decided to move several of our wordpress websites to new upgraded hosting accounts. In most accounts, hosts will offer the opportunity to help you moving your websites and I could have used those services but I decided to do them on my own. Why?

-Hosts generally will know only about “standard” wordpress installations: We have several features such as our DividendGuyBlog Dividend Quiz that are likely things they could miss when moving the website.
-I think moving a website is a great opportunity to take a look at the settings, plugins, etc and improve, upgrade those at the same time

How Does A WordPress Site Work?

I think the first thing I’d like to explain is how a wordpress site works. It might be obvious too many of you but Mike, who often calls himself techno-retarded (believe me, he’s not) and others might not know. There are basically two different parts to any standard wordpress site.

1-Files: All of the different files, images that are used in the website, that make up its look, all of the plugins, etc. These files do not change very often in for most blogs, going back to the files that were used a few weeks before would not be easy to notice for visitors.
2-Database: This is the core of any wordpress site. All posts, pages, settings and a lot more is stored in the database. That is also why having a backup of that database done (ideally automatically) at least once per week is a great idea for most active sites. It can easily be done through a free plugin, and I think it’s well worth the 10-15 minutes that it will end up taking you.

The other part that you must know about is the domain. If you own your own domain, like TheFinancialBlogger, that domain points to a specific set of “nameservers”. Think of nameservers as an address. It basically tells all internet providers where to go when a visitor tries to visit TheFinancialBlogger. The format of these nameservers generally looks something like:

NS1.HOSTGATOR.COM
NS2.HOSTGATOR.COM

When a visitor types Thefinancialblogger.com, your internet provider will know to send that query to those nameservers. Hostgator will then point it directly to where the website is located. It happens very quickly but it’s important to understand this part.

Why It Matters

Because in fact you could make a copy of all of your files, the database and install everything on the new server and nothing would happen. In fact, that is probably what you should do. Once it’s done, you will then need to change the nameservers before visitors actually see the new location. That change can take some time, up to a few hours (it used to be 24-48 hours). So let’s get right into it.

Step 1 – Setup The New Domain At New Host

Remember, as long as you do not change the nameservers, no one will know that a change is occurring. You should ask for the setup of the domain as early as possible as that might take longer than other steps depending on the host. Usually, when you sign up, you will be able to specify what domains you would like to use. If you are planning on using a more advanced account such as a VPS (like we did), it might be a bit more complex to do that setup but it’s one time thing.

Step 2- Download All Of The Files

If you are not running the most updated version of wordpress, it might be a good idea to update it before going further. What you need to do is connect to your current server to download of all the files. That can generally be done through an FTP client. What is that? You can download a free program such as Filezilla here. It is free and very easy to use. You simply need to install the program, get the ftp login information from your hold host and download the directory to your computer.

Step 3 – Upload All Of the Files To Your New Server

This step is as easy, you simply need to get the same information from your new host, take all of the files that are in your main wordpress directory (the one that includes directories such as wp-admin, wp-content, etc) into the main directory.

Step 4 – Download The Database

The core of most websites these days is not the hundreds of files but rather that database.  There are many different ways to get the database but I personally highly recommend that you use phpmyadmin. On most hosts, you will have this already installed and be able to reach it from your control panel. For others, you might need to install phpmyadmin. If that is the case, you can simply go to the official phpmyadmin webpage. Then, simply download the file, unzip and upload to your server (using ftp again) and follow the instructions. It will take you a few minutes.

To log into phpmyadmin, you will need the name of your database as well as the user and password. Don’t know them? No problem:) In fact, one of the files that you downloaded, wp-config.php in your main directory has that information. Simply open the file and take a look:

Then, you will be able to enter phpmyadmin, at which point you can simply select the right database

You can then select: Export and download the entire database:

Step 5: Upload The Database To Your New Site

Using the same method, you can log into the phpmyadmin of your new host, go to “import” and select the file that you downloaded. Be sure to keep a copy of this, it could prove very useful

Step 6: Modify The Wp-Config Of Your New Host

It is likely that the database name, user and password have changed, you will need to change those 3 settings in your new file.

Step 7: Modify Permissions

Many of the wordpress features such as being able to upload images require certain permission changes. By using ftp, you will be able to change most of the permissions. How? For starters, simply log to your new host, then select the directory:

Then, simply write down “777″ which will make it possible to upload images and make changes from your wordpress site.

Other areas that you will probably want to change permissions for are:

your theme files in wp-admin/themes/yourthemename/
you might need to make such modifications for certain plugins such as cache plugins.

Step 8: Modify Nameservers

Up until now, all of the changes that you have done were not visible by either you or visitors. If you are able to live with a few bugs and will be able to work on the site, I suggest that you go ahead and do this. Keep in mind that some visitors might have an impact so ideally you would not do this during the most active days on your sites. On most of our sites, weekends are much slower so we did most of our transfers during those times.

To change the nameservers, you will need to get your new ones from your new server. they will look something like:

NS1.Hostgator.com
NS2.Hostgator.com

Once that is done, you would change the settings for your domain at your current domain registrar. We use GoDaddy so that is where we make the changes. One thing I like to do is to upload a small image in the main folder of the new server. Why? Because by trying to go to that image, I will know when I’m being connected to the new server. What do I mean?

Unfortunately, changes in nameservers do not take effect immediately. It used to take 24-48 hours but thankfully, they now usually take effect within 1-2 hours. Once that is done, you will be able to see your how things look on your new server.

Step 9: Test, Test, Test

Once your site is back up, you will need to test all kinds of features. Look at the homepage, make sure everything is ok. Try looking at posts, pages, going to the archives, trying any plugins such as contact forms etc. You can also try to create and publish a new post with images, etc. It is likely that an issue or two will occur so it’s always easier to work on fixing those right after the transfer.

One other thing that we had not done but will likely do more is ask for others to take a look as well. After the transfer of TFB, we saw everything looking fine. But for many others, they were no longer seeing new posts being added on the homepage. Major problem right? JMoney was the guy who let us know about the issue. Not only that but he also asked his Twitter followers (@BudgetsAreSexy) to test it on their end. Great Idea!!! Turns out the majority was getting the same problem. That was huge help and we truly appreciate JMoney’s help on that.. ! If you have not checked his website (BudgetsAreSexy), it’s well worth a visit! Truly, you might want to ask your readers and friends to take a look, they might see or notice things that you would have missed.

Similar Posts:

You Want More? Sign-up! ->
TFB VIP Newsletter


If you liked this articles, you might want to sign for my FULL RSS FEEDS. If you prefer to receive the posts in your email, subscribe CLICK HERE


Comments

Hi Mike,

Nice post, and I’ll add in a few points. I am in the process of moving my site to HostGator as well. :)

The way you describe the MySQL migration is the best way. Download all your files and then re-upload everything, then import the DB via phpMyAdmin. Then change the config.php file. Keeping the structure on the new site the same as the old site is best.

The WordPress Importer is very buggy, and can create all kinds of problems – so avoid it.

Regarding the last paragraph, Yes you will have all kinds of bugs until the DNS Resolves, which can take 12 to 48 hours – I’ve even seen sites that take up to 7 days. At least 2 days for full propogation. During this time you can expect all kinds of hiccups, from ads not displaying, false twitter counts, etc. All should resolve once the DNS fully propogates (at least I hope it will with twitter).

Regarding CHMOD 777, you should NEVER use this value. It is the weakest security setting. This is very dangerous, becuase the last number as 7 gives outisde access (wordl wide access) to your site and files. That means any hack or SQL injection can hijack your site. For files you want writeable you should use 775. The last number 5 locks out world wide access, but allows the server to still modify files.

Never use 777 and always use 775 for files and folders you need writeable.

All the best,

Cheers
Avrom ~ The Dividend Ninja

I forgot to include this link, which will show you the DNS propogation. You will want to check the NS (Name Server) Record:

http://www.whatsmydns.net/

Cheers
Avrom

I hope you had better luck than i did.

The domain on one of my blogs was running out so I moved the content to the .com equivalent and the database was too large to be uploaded, I contacted my host and they refused to help as they only allow databases of a certain size to be moved to keep their servers secure. :/

I’m now looking for a new host who isn’t so rubbish. :)