How to Change WordPress Domain
In this article we are going to show you how to change WordPress domain. We are not going to move the actual site to another root directory but will just change site's main domain.
In the example we'll replace
new-hostpulse.example.com. We remind you that in your tests you must replace the example subdomains with your own active sub/domains.
The expression sub/domain simply means there is no difference if you are using domain or subdomain as long as it is correctly configured.
First we need to create another sub/domain and configure it to work from the current site's root directory.
Old domain configuration:
New domain configuration:
Because we do not move files changing the domain name is a matter of replacing the old with the new sub/domains in the database.
We are going to show you two different ways how to do it – you need to choose only one of the three way that suits you best and you do not need to execute all three methods one after another.
Change WordPress domain from phpMyAdmin
From your cPanel > Databases click phpMyAdmin icon or link to open the program.
Expand the databases list if it is collapsed:
Click on the correct database name (if you are unsure take a look in
We are using custom prefix
hstpls_, the default WordPress prefix is
wp_, yours might be different as well.
So click the table
We are going to edit the URLs in the first two rows:
Click on the first Edit link:
Replace current domain with the new one and click Go button to save changes:
Repeat the same step with the second row – you need to have two identical URLs in both rows:
Now if you have been logged in with the old domain your session is destroyed and you'll see this screen:
Close the tab and enter in the browser the name of the new sub/domain
The site is working fine.
http://new-hostpulse.example.com/wp-admin/ and login with existing admin credentials:
Administration also works properly with the new sub/domain.
Change WordPress domain in database archive
In this example we are going to export database archive, using find/replace feature we'll replace the old domain with the new one and we'll import the archive back to the database.
But this time we'll exchange the domains from the previous example – our current (old) domain is
new-hostpulse.example.com and we'll replace it with
We hope phpMyAdmin is still open. If it is not open it again and click on the database name:
Click on Export link:
Click Go button.
The database archive is downloaded to your computer (we recommend you to create copy of the archive):
Open the archive
.sql file with your text editor (find/replace capabilities are required). In the example we'll use
Enter from your keyboard
CTRL+H to open Replace window or click Search > Replace:
Enter current domain
new-hostpulse.example.com in Find what field.
Enter new domain
hostpulse-demo.example.com in Replace with field.
Click Replace All button.
Close the window and click
CTRL+S to save the archive file.
If you try to import the archive back to the database you'll get an error:
We need first to delete all database tables (not the database itself) and then to import the archive.
Click on the database name, click on Check All link to select all tables and from the dropdown menu select Drop option:
On the next screen confirm deletion by clicking Yes button in far right side.
Now click Import link, choose the archive file and click Go button:
Few seconds later you'll see confirmation message:
Again, if you are logged in the just replaced old domain your session will be destroyed by WordPress.
Close the browser tab and enter the new sub/domain
hostpulse-demo.example.com in a new tab.
Both the site and the WP admin panel should work properly.
To follow successfully the example you need to be careful about these few things:
- Configure new
sub/domainto the site's root folder.
- Check in
wp-config.phpfile the correct database name and table prefix.
- Copy/paste domain names carefully to avoid errors.