Top Navigation

How to search and replace links using search and replace script while changing domain name of a website

If you were moving your wordpress database from an old domain to new one and have completed transferring files and database to new hosting account, you might need a search and replace php script that will remove all the links to old domain from your database and replace them with the new one.

download mysql search replace script

The very first step is to download this script from and save it to your desktop. You may rename this script to whatever you want.

mysql search replace links

Additionally, you will be needing a ftp program like filezilla or some other one to upload this file to the root of your wordpress installation.

 Run search and replace mysql script

run search replace mysql

Type in the name of the search and replace script that you just uploaded to your website’s root as shown in the screenshot with your domain name.

For example: in your browser to run this script.

When you hit submit, it will auto detect all the necessary information required in the next step.

search replace mysql

Click Submit DB details to proceed to next step.

wordpress search replace db

Press continue and move to next step. Make sure you have all the tables selected.

wordpress search replace links in mysql

Now, at this stage you can enter your old url on the first field followed by the new one just below it on the other field and press submit search string. It will take few seconds depending upon the size of your database and return a sql query of the operation performed.

No comments yet.

Leave a Reply