WordPress: Repairing broken links after domain change

Recently I moved my blog from medicblog.net to informaticar.net. I guess I just can’t find appropriate name for my personal domain. I host my website on wordpress and after moving, there were a lot of links (and pictures) that haven’t work anymore because they pointed to medicblog.net domain.

SearchReplaceDB1

So I needed to replace all the links to the old domain on my blog. It would be pretty painful job since there is lot of content on the blog.

I searched around a bit, and found a perfect tool on InterconnectIT – https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ Database search and replace script in PHP.

Before we go any further – BE SURE TO HAVE BACKUP OF YOUR COMPLETE WEBSITE INCLUDING DB. Anything can go wrong. Also, as always, you do everything at your own risk.

Download zipped installation from InterconnectIT, and after that create new folder in the root of your website and place files in that folder. I created folder named \trazijado

SearchReplaceDB2

It’s extremely unsecure operation so be sure to delete directory soon after you finished.

Next step is to run command in your browser. Point browser to the directory where you copied search/replace script, it would be something like http:\\mydomain.com\searchreplacedir

In my case it was https://www.informaticar.net/trazijado/

My old domain was medicblog.net and I wanted to replace it with informaticar.net

So, field setup is as follows:

Search/replace – replace: your old domain (in my case medicblog.net) with: your new domain (in my case informaticar.net), I left use regex unchecked

database: name, user, pass, host should be automatically filed by script. I deleted data from screenshot for security reasons.

tables: I checked all tables. Setup according to your needs.

actions: I first clicked on update details and after I was ready (remember to backup before this) on live run

SearchReplaceDB3

Popup turned up before live run, click OK if you are sure.

SearchReplaceDB4

All went well in my case, everything is replaced.

SearchReplaceDB5

After refreshing website and visiting link from the beginning of this post, success

SearchReplaceDB7

Don’t forget to delete script from your server after you finish.

SearchReplaceDB6

 

Disclaimer