If you need to change the URL of your installation of WordPress CMS because of changing domain names or want to move it locally to your computer to test e.g.:
or to your own computer:
There are certain steps that should be taken to ensure proper migration.
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 URLs:when creating 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.
- Update file
wp-config.phpwith the correct data to new database, login and password. Don't confuse users for the database with users in WordPress. Users in WordPress follow the database while users for the database are specific and configured in the file
- Update all old URL:er with the new URL:one in the database according to the guide below.
URL change guide:in the database to WordPress
N.B.: The guide uses SQL command based on ”MySQL replace ()” function to change the database. To run SQL command, log into MySQL database with WordPress tables via phpMyAdmin or login to the DB server and run MySQL client as root.
'old url' to your existing domain type
'new url' to your new URL type
It should be
To update the new URL:in, use the following four SQL commands:
UPDATE wp_options SET option_value = replace(option_value, 'old url', 'new url') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET guid = replace(guid, 'old url', 'new url'); UPDATE wp_posts SET post_content = replace(post_content, 'old url', 'new url'); UPDATE wp_postmeta SET meta_value = replace(meta_value, 'old url', 'new url');
- Log into the database with phpMyAdmin.
- Select the table to update.
Select tab SQL at the top.
- Paste your updated SQL comms as above.
- Test drive. If you don't get any hits, you've typed something wrong in commands, check carefully.
- When it looks like it's working, run the command for real.
Now just try the new URL..