We need to change domain url of a WordPress site in the following conditions:

  • When we need to make live a localhost developmental site to its remote destination
  • When we need to create a staging remote website (or shifting a staging website to a live website)
  • When we are changing site address. (shifting a website from one to another domain or sub-domain)

For instance, I seek to implement major design changes to my WordPress such as changing the theme and applying the design changes to new theme. But at the same time I will never want visitors' experience disturbed- a disturbed experience that may arise due to any changing procedure. And nor will I want to put my website in maintenance mode as it will cause traffic loss.

There are many hosts that offer in-built site staging features:

With the staging tool offered by these hosts, you can create a staging version of your live website and then push the staging site to the live site any time at your convenience.

But just imagine a scenario that you have no tool (or a plugin like UpdraftPlus and BackupBuddy) to change WordPress website address, what will you do and what are your options? Either you try to change site address via phpMyAdmin or try a domain changer WordPress plugin. These methods do work but can’t change site address in many database tables.

Fortunately, now there is something you can bank upon: a small php script, a panacea to above problems, thanks to its developers Interconnectit. This php script is in fully functional mode and I have tested it myself. I have used it to create a staging website for webcusp.com and I didn’t find even a single link un-replaced.

Warning – You must take a full database backup of your WordPress before using this script.

How to use the PHP Script

  • First of all, copy all WordPress files to the destination where you want to deploy your WordPress with changed site address
  • Create a new database and import your existing WordPress database into this newly created database
  • Update database detail in wp-config.php
  • Download the PHP script and copy its folder in the same destination where you have copied WordPress
  • type the following url in your browser address bar and hit keyboard ENTER button;


  • replace blue text with your WordPress base url (where you have copied your WordPress files) and replace red text with the folder name that contains downloaded php script files (make sure you have updated domain namesevers if you move your WordPress from one to another host, otherwise script will not run)
  • Script interface will open
  • Add the old WordPress base url in “replace” field and current WordPress base url in “with” field

Change WordPress site address

  • Click on the “live run” button.
  • Script will start working and within a few minutes it will finish the process.
  • Open the new address in browser and check whether or not every link link is migrated to new address.
  • After that, delete the script using “Delete me” button

Change WordPress site address - delete after completing the process

This script may also be used to replace any text across your WordPress database. For example to replace an affiliate link.

About Shams

Shams, a professional blogger, has expertise in WordPress and Web Hosting. He is used to playing around with WordPress plugins, themes, web hosting services and some other innovative stuff regarding web design. He sifts out good stuff for web designers and reviews it to help them choose what they really need.

Being an energetic tech enthusiast, he regularly pens down breaking news and tutorials related to technology particularly Smartphones and other gadgets. Sometimes writes tech tips too. It was the dawn of Internet age when he started dabbling in it and has since been delving into the realm of the internet. He occupies a permanent burrow in virtual world.

He can be reached at.- here