How to launch a Wordpress dev site

  • June 1st, 2009 by Fred

Tags: , , , ,

Launch

launch_thumbLaunchAlthough walking through the nuances of web development is not the most practical nor obvious method for empowering nonprofits, we here at Empax believe very strongly in the motto “Give a man (or woman) a fish; you have fed him (or her) for today. Teach a man (or woman) to fish; and you have fed him (or her) for a lifetime” and therefore I thought it might be nice to share some great resources to guide you in launching a Wordpress site.

The new Empax website utilizes the Wordpress open source CMS, and it was developed on the same server that it now lives on. Therefore, the steps needed to take our dev site live invloved fewer steps than would be needed if we had developed locally or on an entirely different server – especially on the database end. We used a subdomain of the https://empax.org to develop the site, and for purposes related to this article let’s imagine that this subdomain was http://newsite.empax.org.

Our server was set up so that the old version of our site was in a folder called empax.org, and new site was in a folder called newsite.empax.org. The first step towards launching is to change the older site’s folder name from empax.org to oldsite.empax.org, and the new site’s folder from newsite.empax.org to simply empax.org. This effectively gets our domain pointing to our new site.

From here, Wordpress has some resources that allow you easily get the backend admin interface up and running again. If you open your new site’s wp-config.php file and at the end of all of the DEFINE statements, you add this line of code:

define('RELOCATE',true);

Then you simply login to your Wordpress backend as you would before (i.e. https://empax.org/wp-login.php), and the first thing to do is go to your “Settings” and change your WordPress address (URL) and Blog address (URL) from http://newsite.empax.org to just https://empax.org. This gets some of your database updated and will get location of your site in place. The next step is to get all of the permalinks to your posts and pages working properly by removing the subdomain from their structure.

The following steps are a bit advanced and involve editing your database directly with phpMyAdmin and if you are not comfortable doing this, I would advise not attempting it as the effects of taking these steps are permanent and may fairly well break your site if not done correctly. I would also advise against using this article and this article alone as your sole guidance when migrating. Wordpress has a nice guide here, however it can be a little confusing because it contains additional information that may be superfluous. Please take GREAT care when editing your database and do lots of research specific to your own situation and proceed accordingly. With that said, here’s what we did to get our posts, pages and content all working correctly.

I first would do a find a replace for any reference to http://newsite.empax.org in the GUID fields of the database. So from the “SQL” tab in phpMyAdmin, I would type the following:

UPDATE wp_posts SET guid = REPLACE (
guid,
'http://newsite.empax.org',
'https://empax.org');

And click “GO”

If done correctly, you should then have all your posts and pages linking together properly, but you may notice that images in your pages and posts are not showing up. To fix this, you will now need to do the same thing to your post_content database fields. So, I would type the following:

UPDATE wp_posts SET post_content
= REPLACE (
post_content
,
'http://newsite.empax.org',
'https://empax.org');

This should do the trick. The only left to do is to update any manual references to your old site url, so troll thoroughly!! For the new Empax site, we use some flash that reads directly from our blog’s RSS feed. When we updated to the new feed, we recieved this error message:

XML Parsing Error: xml declaration not at start of external entity

It took some time to figure out exactly what the issue was, but apprently it’s a common issue and it can be resolved by ensuring that there is no white space outside of the opening and closing tags in the following files:

wp-rss2.php
wp-atom.php
wp-config.php
functions.php

I discovered this solution by cruising the Wordpress help forums and stumbling upon this resource. Once I went through these files and removed the blank white spaces, the feed returned and our flash pieces were running like greased lightning.

Hopefully this is helpful and you encounter very little trouble launching your site. Remember that even if you do, chances are someone has had a very similar problem and has publicly cried for help on the web and left evidence of their trials and tribulations for you to learn from, so do some research and pay attention to avoid making any avoidable errors.
Good night and good luck.

External Resources
Wordpress.org
Changing you Wordpress site’s URL
XML Parsing Error: xml declaration not at start of external entity
photo credit: jurvetson

Update

There are two more important things I forgot to mention that are essential to getting your site running smoothly post-migration.

  1. Check the settings for your plugins to make sure that they are set to the new URL. For example, we use the nextGen Gallery plugin for our slideshows and this has to be manually changed in the Wordpress admin interface.
  2. You will need to change the settings for your media uploads in “Settings > Miscellaneous” (which btw, shouldn’t this be in “Settings > Media”???? Wordpress???). If you don’t re-configure this the system will start a new folder (called http:, or something like this) and begin adding your files there.

There is one comment to “How to launch a Wordpress dev site”

  1. Kelly says:

    Thanks for the tip. Our org has very little to spend so we are very DIY. This means I do most of the web work. Thanks!

Leave a Comment