I'm helping my wife migrate a WordPress site for an organization that she is a part of. When we exported the database, I ran a sed command in bash to convert instances of //previousDomain/path to just /path, and this has seemed to mostly work.

However, whenever we edit a page that has a root-relative link, the link is appended with a domain name, that we believe is related to some previous hosting in the past, but is neither a valid domain anymore, nor is present anywhere in our database files (excepting for the pages we have edited) or the php code itself. (The change is from /path to http://foreignDomain/path.)

It smells like this might have something to do with JetPack, but we cannot find any toggle or field to prevent this from happening, and, as far as we can tell, certain content settings are contingent on JetPack. However, we do not know for certain if this is the case.

closed as off-topic by Mark Kaplun, cjbj, Jack Johansson, Dave Romsey, Max Yudin Jul 6 '17 at 11:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?" – Mark Kaplun, cjbj, Jack Johansson, Dave Romsey, Max Yudin
If this question can be reworded to fit the rules in the help center, please edit the question.

  • you should not use relative urls. the only valid "relative" thing to do is to be protocol neutral (and some people will argue about that as well). In any case running sed is just a broken idea use the proper wordpress tools to search/replace urls. – Mark Kaplun Jul 5 '17 at 4:29
  • ... and sorry but downvoted since the question at its current form can not have any useful answer, just guesses. – Mark Kaplun Jul 5 '17 at 4:31

WordPress is strongly opinionated about using absolute URLs. It’s not right or wrong, just the way it is. One of the reasons for their decision is exactly the unholy complexity of migrating relative URLs, which can be very hard to adjust when moving levels is involved.

If existing WP install is using relative URLs, then someone had to go extra mile to make that adjustment. It is hard to guess what they have done and how.

For a long term solution practical recommendation is too comply with WP native approach and normalize to using absolute URLs.

Not the answer you're looking for? Browse other questions tagged or ask your own question.