Hey everyone! I'm in the process of setting up a brand new WordPress website because I want a fresh start, rather than just importing my old database. I'm manually exporting some posts from my old site, which is still live with its own domain name, while the new site is currently using a temporary domain. My main concern is how to deal with the internal URL links when I import these posts. When I first created my site years ago, I used absolute URLs instead of relative paths. I've heard mixed opinions about whether I should update these links to the temp domain now. Some people say I should keep the original links intact, reasoning that once I switch the domain to the new site, everything will link correctly. ChatGPT suggests changing them, but I'm worried that could lead to errors. Any advice on what the best approach is before I go ahead and import? I really want to avoid any mess-ups. Thanks a ton!
4 Answers
For sure, keep it simple and don't change to the temp domain. Making changes like that can create more issues when you switch to the live domain.
A solid approach is to replace your absolute URLs with relative ones. You can do a global find and replace for your old domain to just '/' . If you want to be more precise and target only specific attributes like href, src, etc., you can use regex in your find query to ensure you're only updating what you need to.
You're on the right track—definitely don’t change the links to your temp domain! Keeping the original URLs means that when you finally switch over to the new site, all those internal links will work as intended since the domain will still be the same. Changing them now could complicate things later, especially if you end up having to revert back to the original URLs afterwards. Once everything is migrated, if needed, you can use a plugin like Better Search Replace to catch any lingering links to the old domain.
I’d recommend using WP CLI to update the links to the new domain when you’re ready to go live. This way, you can make sure all links are correctly pointing to the new domain right at the switch. It's a very efficient way to handle it without messing around with different URL states during the import process.

Related Questions
How to Build a Custom GPT Journalist That Posts Directly to WordPress
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads