Move a WordPress One Domain to Another

Home / Wordpress / Move a WordPress One Domain to Another

In some cases user need to move wordpress to subdomain or move wordpress from subdomain to main domain. Students in basic computer classes can learn how to move wordpress to another domain. Here I want to show you how to move wordpress from one domain to another.

move wordpress site from subdomain to main domain


Please follow this step for moving your wordpress site.

1. Please take backup whole site with database.
2. Compress, Download & Upload site files via FTP or SSH (Secure Shell).
3. Open wp-config.php and edit with to set your new domain.

define('WP_SITEURL', 'http://www.NEW-DOMAIN.com');
define('WP_HOME', 'http://www.NEW-DOMAIN.com');

Put this code at top of the file.

4. Edit wp-config.php with your new Database settings (host, db, user, password)

5. For replace old URL with new URL from your database please run below query with your old and new database name.

Update your site URL

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

Update Permalinks in DB

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

Update Any Links within your blogs content

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-url.com', 'http://www.new-url.com');

6. Change in your new doman name .htaccess file.

7. Update your sitemap.xml

8. Change your FeedBurner account, if you have one, to pick up the correct feed.

Note: For 1and1 users edit the .htaccess file to force the server to use PHP 5.
AddType x-mapp-php5 .php

Related Posts

Leave a Reply

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