Change WordPress Site URLs (the address of your wordpress site) Print

  • 2

How to Change WordPress Site URLs:

There are multiple ways that wordpress' address or a wordpress site's URLs can be updated.
 
Please be aware this information is specific to wordpress rather than our platform. The following is considered guidance, and we provide no support for this, other than what you see here.
 
These instructions may or may not function depending on how your theme operates.

1) Via wordpress admin panel (wp-admin):

Login to the Wordpress admin panel >> Settings >> General page.

From here you can change WordPress site URLs under the ‘WordPress Address’ and ‘Site Address’ options.

Then click on the ‘Save Changes’ button to store your settings.


2) via the functions.php File:

Login to the cPanel >> File Manager.

And go to wordpress-installation-directory/wp-content/themes/your-theme-folder/ and locate the file functions.php.

Open this file and add the following code at the bottom:

============
update_option( 'siteurl', 'https://example.com' );
update_option( 'home', 'https://example.com' );
============

Save the file.

3) Via wp-config.php file:

Login to cPanel >> File Manager.

Open the file wp-config.php in Edit mode and add the following code just above the line that says ‘That’s all, stop editing! Happy publishing’.

============
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
============

Save the file.


4) Via PHPMyAdmin:

Initial step is to take a database backup. This is very important as we are going to edit the database.

Then login to cPanel >> PHPMyAdmin >> Click on the database associated with the Wordpress installation.

Next, you need to scroll down to the options table.

PhpMyAdmin will now display the rows inside the options table. You need to locate the rows where option_name is siteurl and home.

Next, click on the pencil icon on the left to edit each row and change the option_value field to the new site URL. After that, click on the tiny Go button at the bottom right corner to save your database changes.
 
In addition you may then need to carry out the following:


5) Via the plugin Better Search Replace

1. Once the plugin is installed, the plugin settings will be available in "Tools >> Search & Replace".

2. Click on "Search & Replace" tab.

3. In the list of tables, check "Select all tables".

4. In the "Search for:" field, enter the text that you want to search for.

5. In the "Replace with:" field, enter the text that you want to replace. Let's say you want to replace all site URLs to https://example.com from https://yourdomain.com, you would enter your domain (eg. "https://yourdomain.com") in the "Search for:" field and enter the example.com domain (eg. "_https://example.com") in the "Replace with:" field.

6. Click "Dry Run" to make a test run. Running a "Dry Run" shows what would be replaced in the database.

7. Once you are happy with dry run, uncheck "Dry Run", select "Save changes to database" and click "Do Search & Replace"

Was this answer helpful?

« Back