Replace hardcode link with phpMyadmin

At the beginning, this blog use address hostingformula.info and because I use bluehost I have free domain hostingformula.net . The transition from .info to .net is smooth with help of permanent redirect 301 .

Old domain no longer work since its expired and wordpress stats tell me with this data :

Sure, 301 redirect only work if old domain and new domain are active. If one of them no longer work then I must doing something to overcome this issue.

After think for a while I decide to replace old link that might be linked manually with new link.

Here the steps I do :

1. Login to cpanel and open phpmyadmin

2. Enter login information

3. Backup database for sure

4. Open SQL box

Yes, basically I’m going to use find and replace command.

General form of the command

update [table_name] set [field_name] = replace([field_name],'[string_to_find]’,'[string_to_replace]’);

table_name is wp_posts

field_name is post_content

string_to_find is http://www.hostingformula.info

string_to_replace is http://www.hostingformula.net

Using all those information, new query I can use inside SQL box is :

update wp_posts set post_content = replace(post_content,’http://www.hostingformula.info‘,’http://www.hostingformula.net‘);

Hit Go button and I got this result

Yes, 6 row(s) affected. It means all link fixed to new domain name.

I repeat that command with no www in front of domainand I got 1 row affected.

Phew, 7 row got replaced.

If you have thousand post and face same problem you can save your traffic from being redirect to parking domain 🙂

Hope this post useful, stay health!