Enterprise WordPress – Things You Have to Change – Robots.txt, wp-config.php, etc.

After all the hullabaloo in getting WordPress ready and implemented for the enterprise, with a DEV, QA and PROD environment, there are a lot of small gotchas that are still sitting around. For those of you trying out WordPress for the Enterprise level, these are the little gotcha’s to worry about, and Robots.txt is one of them:

  • Robots.txt
    Robots.txt needs to be different in each level of DEV, QA and PROD. If you are using SVN this can be a challenge. If you don’t know what SVN or CVS are, then don’t worry about this one. Basically as you copy the site from DEV to QA to PROD, you end up with the same robots.txt. This can’t happen from a technical perspective, since you really want robots.txt to block the search engine bots on DEV and QA, and not on PROD.
  • wp-config.php
    wp-config.php, the settings file for WordPress, needs to be modified if you are spanning the code across DEV, QA and PROD. Simple answer for this, use the old PHP switch statement and change the site based on server name with case statements. The variable to use for this is $_SERVER[‘SERVER_NAME’]. A good example is below:

    // ** MySQL settings – You can get this info from your web host ** //
    switch( $_SERVER[‘SERVER_NAME’] )
    {
    case “dev.strategicpoints.com”:
    define(‘DB_NAME’, ‘dbname’);
    define(‘DB_USER’, ‘dbuser’);
    define(‘DB_PASSWORD’, ‘dbpassword’);
    define(‘DB_HOST’, ‘localhost or SERVER NAME’);
    break;

    case “qa.strategicpoints.com”:
    define(‘DB_NAME’, ‘dbname’);
    define(‘DB_USER’, ‘dbuser’);
    define(‘DB_PASSWORD’, ‘dbpassword’);
    define(‘DB_HOST’, ‘localhost or SERVER NAME’);
    break;

    case “www.strategicpoints.com”:
    case “strategicpoints.com”:
    define(‘DB_NAME’, ‘dbname’);
    define(‘DB_USER’, ‘dbuser’);
    define(‘DB_PASSWORD’, ‘dbpassword’);
    define(‘DB_HOST’, ‘localhost or SERVER NAME’);
    break;
    }

  • Server Name in Mysql
    It is important to make 2 changes in each DB when migrating MYSQL between DEV, QA and PROD. These are in the wp_options table, and if you have been through this drill before they are pretty explanatory. The option names you have to change are “siteurl” and “home” to the full path of the site such as http://www.strategicpoints.com.

To solve some of these incompatibilities between the DEV, QA and PROD there are plugins and other things that need to be put in place in order to keep these versions in sync. This is a major challenge. As I solve each one of these issue or more issues, I am going to update this blog post.