When changing the domain name of a WordPress powered website, WordPress settings should be modified to reflect the new name. The changes will allow WordPress to actually use the new domain. The links, images and attachments which refer to the old domain name should also be updated. Remember, that the domain name change means changing something like blog.com to newsite.com.

The basic things outside WordPress configuration:

Changing WordPress Settings

The first thing that needs to be done is to change the WordPress settings to point to the new domain. This can be done from different places:

If WordPress admin area is accessible

If WordPress admin area is NOT accessible

After moving files to the location that is pointed to by a new domain, it is not possible to access the content through the old domain name. The new name hasn’t been set up in WordPress and so accessing the admin area won’t be possible. In such a case, the new WordPress address and site address can be hard coded in wp-config.php or theme’s function.php file.

Follow any one of these two methods:

1. For wp-config.php

[php] define(‘WP_Home’,’http://newsite.com’);
define(‘WP_SITEURL’,’http://example.com’);
[/php]

2. For theme’s function.php

[php] <?php
update_option(‘siteurl’,’http://newsite.com’);
update_option(‘home’,’http://newsite.com’);
?>
[/php]

Remember to replace newsite.com with your actual new domain name. After the change is made and the file is saved, it will be possible to access the admin area using the new web address. Then, from the admin area, Settings > General change the WordPress Address (URL) and Site Address (URL) value to your new domain. You can now remove the hard coded address change information from wp-config.php or functions.php of your theme.

Changing Media and Links

Even though the site address information is changed in WordPress settings, the images and links that are present in posts will point to the old URL. This information is present in the site’s database and is not updated. That means all the images embedded in posts and pages will not load. The internal links that are present within posts and pages will also not work. A plugin should be used to batch update this information to contain the new domain URL.

We recommend the use of Velvet Blues Update URLs plugin.

Here are the steps involving this plugin—Velvet Blues Update URLs:

Leave a Reply

Your email address will not be published. Required fields are marked *