Best Practices for Handling URL Links When Importing Posts to a New WordPress Site

0
5
Asked By CraftyCoder92 On

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

Answered By WebNinja88 On

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.

Answered By LinkMasterX On

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.

Answered By DevGuru45 On

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.

Answered By WPWhizKid On

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.