Questions? Feedback? powered by Olark live chat software

wordpressOne of the biggest problems you will encounter when moving a WordPress site to a new server, is that you may get Internal Server errors and links to posted images may become broken. Let’s face it: despite being very robust and powerful, WordPress is lacking a clear and easily understandable way to transfer your site from one server to another.

Having recently transferred two of my own blogs built on WordPress from my localhost to my final hosting space has proven to be a rather difficult task, as the information available to do this is long, mostly hidden in content between pages, and distributed over various blogs and help tutorials. This article is dealing with this issue, and this issue alone: moving your WordPress site from one server to another, by following the process of setting up the Webtalk blog.

After installing WordPress on my localhost, and posting my first article, I moved my site live to my server at http://www.webtalk.co.za. Immediately, the site started to exhibit the problems mentioned above:

  • The site pages did not display correctly
  • Images were not showing in posts
  • Viewing the full post resulted in an Internal Server error.

The first and most important thing to do, after changing your database settings, is to change your siteurl variable in your wp_options table to your new URL, in this case, change it from http://localhost/webtalk to http://www.webtalk.co.za. This should take care of the immediate problem that your site pages do not display correctly.

Secondly, to resolve images not showing, you have to run a query on the database to replace all your images’ path from the localhost to the live domain. This could typically look like this: UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, ‘http://localhost/webtalk’, ‘http://www.webtalk.co.za’). You would need to repeat this query also for permalinks and comments, where needed. This will take care of images not showing as they should.

Finally, here comes the kicker: getting rid of that pesky “500 Internal Server Error”.

Server Error

The WordPress CodeX explains this in a long and windy manner. And here, my friends, is the key to this article. The simple way to resolve the Internal Server Error:

  • Go to your site admin, and change your permalink settings to Custom type
  • Leave the custom type the same as the previous structure that it was.
  • Save your settings. Your page should be displaying correctly now.
custom structure

Now your question is: WHY does this solve the problem?

The simple answer is that it rewrites your .htaccess file that handles your permalinks. The Codex article explains that you need to remove your .htaccess settings, and provides various other longer descriptions and tips and tricks to get this problem resolved, but the fact remains that this can be resolved by simply faking the change of your permalink settings.

Happy blogging!

Author: Kobus Myburgh

 

 


 

{ 3 comments… read them below or add one }

realloc March 9, 2012 at 9:29 am

You could use the WordPress-Plugin Search and Replace for updating the URL in your DB.

Adam Chronister March 9, 2012 at 2:34 pm

Hey that’s a great tip. I know there are a few different ways to tackle this and that sounds like another great option. Have you used that method? If so what was your experience?

Heather June 28, 2012 at 7:38 pm

Wow Thanks Adam. I can’t believe i’m actually reading and using a post you created. I am in the middle of moving from crappy Ipower hosting to WestHost in Oregon. I’m liking it so far.

Can I ask you a question? I’m following a couple tutorials and although I am copying files and databases to move over to the new host, no one really mentions If I should first install wordpress on my new host before I move the files over. I’m worried about how this will effect my tables in MySQL.

Leave a Comment

This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage.