If you need to change the URL to your WordPress blog / CMS because of the change of domain name eg. from
or to a different directory, eg. from
There are certain steps that should be made to ensure the proper migration and no broken links.
The difficult part of that move WordPress to a different location is that WordPress uses absolute paths in URL link instead of relative paths. Within the blog entry, actual content, users can also use the old URL:you when you create references, backlinks. All these values ??in the database will need to be changed when WordPress is moved. The following guide will show you which database fields have references or values ??related to URLs that have changed.
- All files are copied from the old location to new
- Export the database from old to new. Link to good guides: Export – Import
- Update the file 'wp-config.php’ with the correct data to new database, login and password.
- Update all old URL:one with the new URL:one in the database provided guid below.
N.B.: The guide uses SQL command based on “MySQL replace ()” function to change the database. To run SQL jommando, log into MySQL database with WordPress tables via phpMyAdmin or login to the DB server and run MySQL client as root.
To update the new URL:in, use the following SQL command:
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';
Since the WordPress posts and pages are updated with the new URL which is stored in database wp_posts table fields 'guid'. Update with the following SQL command:
UPDATE wp_posts SET guid = replace(guid, 'http:/www.old-domain.com','http:/www.new-domain.com');
Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:
UPDATE wp_posts SET post_content = replace(post_content, 'http:/www.old-domain.com', 'http:/www.new-domain.com');
Cloudy! Browse through the WordPress site to check if everything is okay. You also need to sign in again to your cookie has become invalid due to different domain.