URLs in a Migration from WordPress to Frontity Decoupled Mode

If you are migrating an existing WordPress site to Frontity and you are using Decoupled Mode, you will need to change the URL of your WordPress site. You need to do this as the primary domain (i.e. the one that site visitors use) will point to the Frontity site, and the domain that points to the WordPress installation will need to be changed to the secondary domain (or subdomain).

The issue with URLs in this scenario

Let's take as an example a WordPress site under the domain www.domain.com. Let's suppose that we want to migrate this to Frontity in Decoupled Mode. We will need to make the following changes:

  • www.domain.com will point to the Frontity server

  • wp.domain.com will point to the WordPress server

In this scenario internal links that exist in the content when the WordPress URL is changed to wp.domain.com will still point to www.domain.com. However, if any content is added after the change then internal links will point to wp.domain.com. This creates a situation where internal links in the content are inconsistent, with "old" links pointing to www.domain.com and "new" links pointing to wp.domain.com.

Note that WordPress always uses absolute links internally, rather than relative links. WordPress uses the internal URL Settings to determine where the internal links should point to.

In addition, the link processor uses the domain configured as the WordPress data source (which will now be wp.domain.com) to convert links to a <Link /> component. So if the internal links are left pointing to www.domain.com the link processor won't work on those links because it will only convert links pointing to wp.domain.com, i.e. the URL of the WordPress data source.

Updating the URLs in WordPress

You will therefore need to change the WordPress Address and the Site Address in the "Settings" page of the WordPress admin so they point to new URL (e.g. wp.domain.com).

Also, for the reasons stated above, any URLs in the content stored in the database also need to be updated to reflect the new domain (e.g. wp.domain.com). This can be done in 2 ways:

  • With a WordPress plugin

  • Updating the URLs manually

Using a plugin

To change the URLs in the content stored in the database you can use a plugin such as one of the following:

Updating manually

You can also update the links manually by running the following SQL commands using either phpMyAdmin or an application such as Sequel Pro or Sequel Ace.

Before running the commands below ensure that you have a backup of your database!

UPDATE wp_options SET option_value = replace(option_value, 'https://www.domain.com', 'https://wp.domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'https://www.domain.com', 'https://wp.domain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'https://www.domain.com', 'https://wp.domain.com');

Last updated