Import breaks absolute links in post_content

Issue Summary

When I import my site (from WPEngine), all absolute, local links in the content are broken.

For example, when I import jovalcm.com → jovalcmcom.local,

  • this link: http://jovalcm.com/capabilities/platform-standards-support/
  • becomes http://jovalcmcom.localcapabilities/platform-standards-support/
    (notice: the / after the domain was removed, breaking the link)

Here is a fragment exported from live site DB:

-- phpMyAdmin SQL Dump of Production DB
INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES
(17, 1, '2015-01-09 15:17:54', '2015-01-09 21:17:54', '<h2>Platform &amp; Standards Support</h2>\r\nHands down, Joval supports more test types, across more platforms, than any other SCAP interpreter.\r\n\r\n<a class=\"btn btn-default\" title=\"Platform &amp; Standards Support\" href=\"http://jovalcm.com/capabilities/platform-standards-support/\">Learn More</a>\r\n<h2>Content Support</h2>\r\nJoval offers best-in-class support support for public and private content.\r\n\r\n<a class=\"btn btn-default\" title=\"Content Support\" href=\"http://jovalcm.com/capabilities/content-support/\">Learn More</a>\r\n<h2>Deployment Architecture</h2>\r\nWhether deployed alongside an existing agent, as a high-capacity agentless network sensor, or in a hybrid environment leveraging both deployment models, Joval has the ability to scale to meet the requirements of any enterprise.\r\n\r\n<a class=\"btn btn-default\" title=\"Deployment Architecture\" href=\"http://jovalcm.com/capabilities/deployment-architecture/\">Learn More</a>\r\n<h2>Integration options</h2>\r\nJoval makes standards-based interoperability a snap, with out-of-the-box HTML reports and drop-in integration options for SQL databases and No-SQL event stores.\r\n\r\n<a class=\"btn btn-default\" title=\"Integration Options\" href=\"http://jovalcm.com/capabilities/integration-options/\">Learn More</a>\r\n<h2>Architecture &amp; Extensibility</h2>\r\nWhile traditional heavyweight solutions are saddled by complexity and legacy technologies, innovation is at the core of everything we do.\r\n\r\n<a class=\"btn btn-default\" title=\"Architecture &amp; Extensibility\" href=\"http://jovalcm.com/capabilities/architecture-extensibility/\">Learn More</a>\r\n<h2>Support Options</h2>\r\nWith low pricing, free upgrades and flexible options, we’ve got your six.\r\n\r\n<a class=\"btn btn-default\" title=\"Support Options\" href=\"http://jovalcm.com/capabilities/support-options/\">Learn More</a>', 'Capabilities', '', 'publish', 'closed', 'closed', '', 'capabilities', '', '', '2015-02-20 13:23:55', '2015-02-20 19:23:55', '', 0, 'http://jovalcm.com//?page_id=17', 60, 'page', '', 0),

Here is a fragment exported from the local site immediately after initial import:

-- Adminer SQL Dump of DB after Local Import
INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES
(17,	1,	'2015-01-09 15:17:54',	'2015-01-09 21:17:54',	'<h2>Platform &amp; Standards Support</h2>\r\nHands down, Joval supports more test types, across more platforms, than any other SCAP interpreter.\r\n\r\n<a class=\"btn btn-default\" title=\"Platform &amp; Standards Support\" href=\"http://jovalcmcom.localcapabilities/platform-standards-support/\">Learn More</a>\r\n<h2>Content Support</h2>\r\nJoval offers best-in-class support support for public and private content.\r\n\r\n<a class=\"btn btn-default\" title=\"Content Support\" href=\"http://jovalcmcom.localcapabilities/content-support/\">Learn More</a>\r\n<h2>Deployment Architecture</h2>\r\nWhether deployed alongside an existing agent, as a high-capacity agentless network sensor, or in a hybrid environment leveraging both deployment models, Joval has the ability to scale to meet the requirements of any enterprise.\r\n\r\n<a class=\"btn btn-default\" title=\"Deployment Architecture\" href=\"http://jovalcmcom.localcapabilities/deployment-architecture/\">Learn More</a>\r\n<h2>Integration options</h2>\r\nJoval makes standards-based interoperability a snap, with out-of-the-box HTML reports and drop-in integration options for SQL databases and No-SQL event stores.\r\n\r\n<a class=\"btn btn-default\" title=\"Integration Options\" href=\"http://jovalcmcom.localcapabilities/integration-options/\">Learn More</a>\r\n<h2>Architecture &amp; Extensibility</h2>\r\nWhile traditional heavyweight solutions are saddled by complexity and legacy technologies, innovation is at the core of everything we do.\r\n\r\n<a class=\"btn btn-default\" title=\"Architecture &amp; Extensibility\" href=\"http://jovalcmcom.localcapabilities/architecture-extensibility/\">Learn More</a>\r\n<h2>Support Options</h2>\r\nWith low pricing, free upgrades and flexible options, we’ve got your six.\r\n\r\n<a class=\"btn btn-default\" title=\"Support Options\" href=\"http://jovalcmcom.localcapabilities/support-options/\">Learn More</a>',	'Capabilities',	'',	'publish',	'closed',	'closed',	'',	'capabilities',	'',	'',	'2015-02-20 13:23:55',	'2015-02-20 19:23:55',	'',	0,	'http://jovalcmcom.local/?page_id=17',	60,	'page',	'',	0),

Notice that the href in post_content has been broken?

It appears that the DB content processing intended to update the local domain is not working as expected.

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular?
    ALL

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    YES

Replication

Describe the steps that others can take to replicate this issue. If you have screenshots that can help clarify what is happening, please include them!

Import my site from jovalcm.com via WPEngine. Browse the site. Encounter the 404s.

System Details

  • Which version of Local is being used?
    Latest: 5.10.1+5267

  • What Operating System (OS) and OS version is being used?

    • macOS Big Sur
  • Attach the Local Log.

local-lightning.log (774.6 KB)

Something about this feels like it’s related to this topic:

Does this site make use of Divi? I looked at the markup and I’m seeing anything that looks like Divi, but wanted to double check.

One thing that stands out to me is that the replaced domain is jovalcmcom.local.

Note that there is a com inside the string.

What is the name of the site in Local? As a test, can you try pulling the site down to a new on in Local, and ensure that the name doesn’t have .com in it?

The reason I ask is maybe there’s an issue with Local regex and I want to zero in on ways to replicate the issue.

Hi Ben,

I don’t use the Divi theme.

The name of the site in local was jovalcmcom.local (which, I think was the default value).

I tried the following:

  1. changed local domain to foo.local using the app/gui
  2. pulled from WPEngine (include DB)

Same problem. Now links are http://foo.localcapabilities/platform-standards-support/

If you can share your regular expression(s) or the source is available somewhere, I’d be happy to take a look.

Thanks for your help!

-David

Hello Ben,

I believe I have resolved this (well, worked around it) based on a hunch inspired by the following comment you made in https://localwp.com/community/t/latest-update-seems-to-have-broken-links/23170/7:

I have seen issues when “force https” plugins are used because they can try and change the URL before the actual server software (nginx/apache) get’s a chance to fully resolve the URL.

I have my live WPEngine site configured to force all pages to HTTPS. I believe this is handled by WPEngine, not Wordpress itself.

In WP-ADMIN > Settings > General, the WordPress Address (URL) and Site Address (URL) were both set to http://jovalcm.com. When I changed those to https://jovalcm.com, the site was imported without breaking links.

I hope that’s helpful to others experiencing this issue.

-David

1 Like

That’s quite interesting, and thanks for following up!

Is this a custom nginx rule you have in place on the remote environment?

It’s a WPEngine setting (a setting in their management console, not in WPAdmin). You can add an SSL certificate to a WPEngine site and then choose “Secure all URLs”:

WPEngine manages NGINX, etc. and I don’t know how they implement this.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.