PDA

View Full Version : Changing the domain name on a WordPress site.



Cameron L
February 18th, 2010, 08:06 PM
If you have an existing WordPress installation and need to change the domain name to something new, its not as simple as just copying your site files to the new domain name.

WordPress stores the domain name in its database and the WordPress settings, so it can cause login problems and other issues if you start to use a new domain name.

It is possible to accomplish a Domain Name change for a WordPress site. I will outline the steps below:

The first step is to change the domain name in the MySQL database that your WordPress is using. If your not sure what database its using check the main "wp-config.php" file. It will have your MySQL host, database name, and the database username/password.

Changing the URL directly in the database:

Using a MySQL management tool like phpMyAdmin (http://phpmyadmin.ezhostingserver.com/), you can edit these values directly to get you up and running again. The following instructions are specific to phpmyadmin.

1. Backup your database (http://forum.hostek.com/showthread.php?222).
2. Login to phpMyAdmin.
3. Click the link to your Database.
4. A list of your databases will appear. Choose the one that is your WordPress database.
5. All the tables in your database will appear on the screen.
6. From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
7. Click on the small icon indicated as Browse.
8. A screen will open with a list of the fields within the wp_options table.
9. Under the field option_name, scroll down and look for siteurl.
10. Click the Edit Field icon which usually is found at the far left at the beginning of the row.
11. The Edit Field window will appear.
12. In the input box for option_value, carefully change the URL information to the new address.
13. Verify this is correct and click Go to save the information.
14. You should be returned to your wp-options table.
15. Look for the home field in the table and click Edit Field. Note There are several pages of tables inside wp_options. Look for the > symbol to page through them.
16. In the input box for option_value, carefully change the URL information to the new address.
17. Verify this is correct and click Go to save the information.
18. Now, via your FTP for the site, Delete the folder wp-content/cache (this is a new folder added with WordPress 2.0).
19. That is it.

After you change the domain name in the database, then you can login into your WordPress admin and change it at the following places:

1. Settings - General - Update the "WordPress address (URL)" and the "Blog address (URL):" if filled.

2. Settings - Misc. - Update the domain name in the "Store uploads in this folder" path, if it has the olddomain.

That should get WordPress using the new domain name.