pattern
month long deals
vw hero
vw hero
more details
View all Products Close Menu Menu
Changing your WordPress website's URL
Updated Monday February 8th 2021 / Category Web Hosting

If you want to move your WordPress website to a new domain name, you will need to make some changes to the website itself to ensure it understands that it’s now operating under a new domain name. There are a few ways this can be done:

Changing the domain name

Updating the wp-config.php file

The easiest way to do this is to simply add the following lines to your website’s wp-config.php file.

define('WP_SITEURL', 'http://my-new-domain-here.com');
define('WP_HOME', 'http://my-new-domain-here.com');

The steps to do this are:

  1. Log in to cPanel.
  2. Click on File Manager under Files.
  3. Navigate to the folder that your website is stored in (this is usually the public_html folder).
  4. Right-click on the wp-config.php file.
  5. Click Edit.
  6. Add the lines of code provided anywhere after <?php at the beginning of the file.
  7. Click Save Changes.

Updating your website’s database

Before proceeding, you may need to find out what database your website is using. To find this info, follow these steps:

  1. Log in to cPanel.
  2. Click on File Manager under Files.
  3. Navigate to the folder that your website is stored in (this is usually the public_html folder).
  4. Right-click on the wp-config.php file.
  5. Click Edit.
  6. You will see the database name next to DB_NAME in the file.
    cPanel wp-config file

You can manually update your website’s domain name in the MySQL Database for it. The steps to do this are as follows:

  1. Log in to cPanel.
  2. Click on PHPMyAdmin under Databases.
  3. Click on the database for your WordPress website, then click on the _options table.
  4. In the _options table, you will find a few entries that include the existing domain name, they will be:
    1. siteurl
    2. home
  5. You can find the rows you need to update by inputting the existing domain name into the Filter Rows field (see below).
    PHPMyAdmin Filter rows
  6. Click Edit next to each row, to change the URL.

Other things to consider

Fixing image links

Sometimes you may need to update your image links after completing these steps. We have a separate guide on how to do that.

Search and replace

There may still be some references to the old domain name in your website’s database. If you find this is the case, you can use a search and replace plugin to update all the references in the database. Before doing this, take a backup of your website’s database using PHPMyAdmin’s export tool.

Clearing  your caches

If you have any caching plugins installed, you may want to clear all cache. The plugin will allow you to do this in the plugin’s management interface, via your WordPress website’s admin portal (wp-admin).

Sites made with Elementor

The way that Elementor pages and content is linked via the database is different. You will likely need to fix these links after changing your domain name – luckily, Elementor has a tool to manage this for you!

  1. Go to Elementor > Tools > Replace URL Tab.
  2. Enter your old-url and your new-url and click Replace URL.
  3. Under the General Tab > Regenerate CSS, click Regenerate Files.
  4. In Settings > General on your WordPress Dashboard, make sure that the URLs are similar.

replace URLs screenshot

Can’t find the answers you're looking for? Check out these other methods of support!