WordPress: Modifying URL from database

You my want change your WordPress URL, this allows you to change the WordPress domain/subdomain, enable or disable “www”, etc. this process can be done by multiple ways but in this guide we will tell you how to change it using phpMyAdmin, we will avoid using third party plugins by doing so.

Note: before following these steps we recommend you to backup your website. You can do it following this guide.

Step 1. Access phpMyAdmin

Once the backup has been done, and if you already know how to access to phpMyAdmin you can already jump to step 2, if not, you can enter phpMyAdmin following these steps:

1. From your customer area go to Hosting > My plans 2. Click on your hosting
 3. Go to the Databases tab on the left side. 4. Now you will see your databases and on the right side the Admin link, click it to open phpMyAdmin.

Step 2. Modifying the WordPress URL

Inside phpMyAdmin go to the “SQL” tab.

phpmyadmin sql

From here you will execute the next SQL sentences to change the URL:

**Note: if you have changed your table prefixes you will have to change it at the SQL queries, our examples will use the default prefix: “wp”.

You will have to change the value ‘http://www.currentdomain.com/' to your new domain/URL value: ‘http://www.newdomain.com/' on the following examples:_**

1. The first query will change the wp_options table:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.currentdomain.com', 'http://www.newdomain.com') WHERE option_name = 'home' OR option_name = ‘siteurl';

Now click Go to execute it.

2. The second query will change entries and pages:

UPDATE wp_posts SET guid = replace(guid, 'http://www.currentdomain.com', 'http:// www.newdomain.com');

3. The next one is to modify the content links:

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.currentdomain.com', 'http://www.newdomain.com');

4. And the last query will change the custom fields:

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.currentdomain.com', 'http://www.newdomain.com');


Support