How to replace all old domain links to a new domain in editor?

Hello,
I was 301 my old domain to a my new domain, I run ghost config {new_url} command and change my admin and website url.
But the problem is I have 200 post and every post have 3 links inside the editor.
If i trying to replace all links with manually it needs to so many effort and time also xml sitemap updates all post update times.
I’m using ghost with Sqlite3 and I almost 6 hours searching of the web and can’t find the solution.
So basically, how to replace all url’s to a with any program, command?
Thank you.

I strongly suggest you try running this on a new Ghost instance and make plenty of backups as you go

You can export all of your ghost content as a json file. Then, you can use the find and replace functionality of a text editor (such as Sublime Text). Finally, you can import your content into Ghost and the URLs should be updated.

1 Like

You can use a massive Regexp on the export JSON file. This is what I did to migrate my 2500 posts.

To avoid to loose your inbound links, you maybe need to create some rewrite from the old domain to the new one.
On my side :

  • I created a rewrite.json file from the admin portail to rewrite /post/2019/03/xxxx.html to the standard slug format.
  • I created a NGINX rewrite to remove the .html extension on all the pages.
  • I changed a function in Ghost to remove my old special chars from my URLs :
    Need to rewrite special chars from my old blog URL