Background:

We recently redesigned our corporate websites here at localsplash.com and over at relevantads.com. The problem we encountered was that we had tested our new designs at a different URL then at localsplash.com. Therefore we needed to change the URL from test.localsplash -> localsplash.com.

After quite a long time of searching for a WORKING example we finally were able to piece the process together from various blogs. Hopefully this will help other people who might have been as stumped as we were with this process.

Disclaimer: These steps imply you know how to use very basic ftp and command line skills and have access to modify via database, ftp and ssh.

Configuration:

We have a LiquidWeb server with cPanel running Apache and WordPress. We decided to switch a domain from http://test.domain.com to http://www.domain.com.

Steps:

1) Modify Apache to recognize the URL. The httpd.conf file is located at the following path:
/usr/local/apache/conf/httpd.conf

Do a “ctl+F” and look in the file for “old.domain.com” or “domain.com” (should be in two places) and modify the URLs- ServerName “newdomain.com” ServerAlias “www.newdomain.com” to your new URLS. We used subdomain but the process is the same whether you are changing from a subdomain or not.

2) Save and restart Apache. This process involves connecting via a telnet/ssh client such a Putty
a)Connect via client by typing username and password
b)Find correct directory below and restarting Apache
/usr/local/apache/bin/apachectl restart

3) Modify wp-config.php
File is located in /home/[first eight characters of existing domain name]/public_html/
Hard code the variable $table_prefix to be equal to the old site value; i.e.:
$table_prefix = ‘testdomaincom_’;
HINT: Place this new line under this line “$table_prefix = $table_prefix . ‘_’;” in the wp-config file

4) Modify WP Database; set the value of site & home to the new domain name.
a) Find your database and search in your “domain_options” table for the 2 rows named “Site” and “Home” and change them from “http://olddomain.com”->”http://newdomian.com”

If you have any questions please ask them in the comment section below and we will be more than happy to help. Thanks