Websites

Moving a WordPress Database to a New Server

Posted in Websites on February 27th, 2009 by Jason – Be the first to comment

This past weekend I had the joy of moving two different installations of wordpress to a new server. The first one, which is this blog, moved from my old godaddy.com hosting account to a mediatemple grid server. The second blog (thebaileyblog) which my wife and I use, moved from a subdomain of sidewaysgravity.com to its own domain.

When moving a wordpress blog from one location to another there are a couple steps you will need to take to make sure that everything continues to work. Wether you are moving a blog to a new server with the same domain name or a new one, the steps stay the same, with only a few extra steps if the domain name is changed.

There are a couple things that you will need when you are preparing to move your blog. You will need an ftp program to be able to retrieve files from your current host and to put them onto the new server. It is also extremely useful to have access to phpMyAdmin and since that is what I used, I will use directions for it. If you are not sure how to access phpMyAdmin, you can contact your hosting company and they can help answer any questions you may have. For Mac users, CyberDuck is a great ftp application.

One thing I cant stress enough is to BACKUP you wordpress blog. I have moved my handfull of blogs and everynow and then something happens and I would be in a world of hurt if I didnt have my backup. You will want to backup not only your database, but also all the files for the blog. Fortunately when you are moving the database between servers, you have to back up the files to do the transfer anyways so you dont have to spend any extra time for the backups. Just dont delete your files until you are completely done and fully tested.

The first step is to login to the existing server with your ftp client and download all your files. I like to create a folder on my desktop and load all the blog files into it. Once you have downloaded all your files, depending on the size of your blog and number of photos this could take a while, you will want to login to your database to backup the rest of the blog. You will need to choose your database and select the export option. From there you can export the entire database as an sql file and save it. This is all you should need to do to backup all of your current blog.

Now to loading your blog onto the new server. First you will need to setup your new database. Make sure you write down your connection information such as your database name, user name and password. Some hosting also gives a specific connection address to databases such as godaddy and mediatemple (gs). Once you finish setting it up you will want to login to phpMyAdmin. Here you have two options, once is to copy and paste the entire sql file that you backed up previously into the sql page (there should be a sql tab). The other option is to select the import function and to import the file. I find that copying and pasting the sql file seems to work the best.

The following step should only need to be done ONLY if you are moving your blog to a NEW domain such as www.myoldblog.com to www.mynewblog.com or if you are changing subdomains. If you are only changing your server but maintaining the same domain name, you can skip these steps and procede to upload your files via ftp.

Anytime you add a photo to your blog, wordpress will store the address to the file with an absolute url, which means once you remove the files off your old server, all those images will no longer work in your new blog. There are also a couple other settings where wordpress stores the blog url and it will need to be changed. The first time I transfered a blog, I went through the database and changed out the urls one post at a time. Since then I have learned a better way. While logged into your database, open the sql statement window and use the following code to update find and replace every instance of the old blog url and change it to the new.

This code will update the site url and home page that is set for your blog. This must be set to the new blog domain for your wordpress to work.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldblogdomain.com', 'http://www.newblogdomain.com');

Next, you will want to update all the image or any file paths that you have added to your blog.

UPDATE wp_posts SET guid = replace(guid, 'http://www.oldblogdomain.com','http://www.newblogdomain.com');

Finally, the following code can update any links within your blog posts that may point to another area of your site. You may or may not want to update this code. Although I dont use many internal links, I still run this just incase I have one or two.

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldblogdomain.com', 'http://www.newblogdomain.com');

Finally as a note, their is one other area where data from your old server is stored. In the wp_postmeta table and meta_value field, the actual server path to images and files is stored. Even though your server path will most likely change when you move to a new server, you do NOT need to update this code. This is one area that can cause all of your images to display at full size and not as a thumbnail as intended. Unfortunately I found this out the hard way. Many wasted hours. I still do not fully understand the reasoning behind this, but I know that your blog images will display properly if you dont mess with these fields.

Finally you are ready to upload the files you downloaded to your destop onto the new server. Before you do this, you will need to open up the wp-config.php file and add your new database information. Once the upload is completed you should be ready to go! If you have troubles along the way or if you know why you cant change the absolute paths held in the meta_value field I would love to know why.

Great Advice to Start your Design

Posted in Ramblings, Websites on May 9th, 2007 by Jason – Be the first to comment

While working on the re-design of sidewaysgravity, this article came in very handy. It is good to gain a better understanding of how to start the design process. By creating the wireframes first and then applying the designs to the wireframe, it was alot easier to setup the design.

Digital-Web.com

Another late night of progress.

Posted in Websites on May 5th, 2007 by Jason – Be the first to comment

Well after much hard work with the design layout of the site, I came to a terrible realization. One, the colors that look so perfect on my macbook, dont look quite the same on my wifes G5, and after I corrected it, it looks yet another color on my Dell PC. So I still have much more work to do. But on the bright side, the main page is coming together, and I am getting the blog incorporated into it.

A New Face For Sidewaysgravity.com

Posted in Websites on May 3rd, 2007 by Jason – Be the first to comment

Since day one of getting this site up and running I have been trying to find some time to build the new look of Sidewaysgravity.com. I have always had this terrible problem with showing my unfinished work to people, so I have tried to keep this redesign unrevealed until It is ready to be published. But old habits are hard to break, so I decided I would meet halfway by only showing a little of the new header.

With my new job, and continuing work on other projects, it has been hard to find the time to work on this site. But with school winding down for the semester, and the ability to stay up late working now at hand, progress is coming at a faster pace.

How to Center your page in HTML

Posted in Websites on February 1st, 2007 by Jason – Be the first to comment

There may be several ways that you can center a page using html, this is only one way that works for me. First things first, when you declare your page, it needs to be something like this:

Important, this text has to be placed inside a container, the bigger than less than symbols.
!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”

Then you can create a large table with the height set to 100% and center the content vertically, and that should get you up and running. From there you can nest a second table with your website content so that when the browser window is resized, it will always be in the center of the screen. One example of this technique is used on brookereeves.com, a website I made for a photography business in Las Vegas.

http://www.brookereeves.com

Update:

The brookereeves link is no longer active.

Back to work

Posted in Websites on January 12th, 2007 by Jason – Be the first to comment

I have received the files that I have been waiting for so that I can get my website projects going again. I’m working on Kansas Water Technologies and Brooke Reeves Photography. Currently both websites are still being put together, but for a while both were standing still in there production process while I waited for more context from the clients. Now they have provided and I am back to sitting in front of the computer till late at night working as fast as I can.

Some of the pages on Kansas Water Technologies have been updated, but many of the product pages continue to have the same content as the home page. This will be changed out as soon as I get the context and have the time to upload it. To view the site you can use the following link:

http://www.sidewaysgravity.com/testsites/kwt/

or

http://www.sidewaysgravity.com/jlb/brookereeves/test4.htm

Update:

Both sites have been finished, but only one is still active. You can see kansaswatertech by clicking here.

Putting wordpress in a sub directory.

Posted in Websites on January 9th, 2007 by Jason – Be the first to comment

If your like me, and had a hard time installing wordpress into a sub directory on your website, you probalby got really frustrated with it not working. I spent several hours trying to delete all the file off the server and reinstall them in the hopes that it would clear up the problems. All in all it was hard, took a long time, and had a very easy and simple solution.

I followed the install directions that wordpress gives you to install it in a sub directory, but it never worked. Turns out the wordpress really just likes to be in the root directory. So quick fix; change the wordpress folder name to the name of the sub directory you want it located in, for instance mine is on www.sidewaysgravity.com/blog/ with blog being the sub directory. Then with your hosting company, have the subdirectory “blog” set up as a sub root directory. Thats all there was to it. After I turned the sub directory into a sub root, everything magically worked and I haven’t had a problem yet.

Update:

This was an issue I had with installing an older version of wordpress and using godaddy hosting. I am pretty sure that this has become much easier, and the problems I faced were most likely related to godaddy. I am using mediatemple now and the install into a sub directory was a piece of cake.