Home » WordPress » Changing WordPress Site Url In Various Ways

Changing WordPress Site Url In Various Ways

This article is representative for Changing WordPress Site URL from WordPress Dashboard or Phpmyadmin or the wp-config.php.

While migrating your WordPress site with to a new domain name, you will need to Change the WordPress Site URL to the new domain name.

There are 2 WordPress options that you can use to adjust the behavior of how WordPress works.

  • WordPress Address (URL) Or WP_SITEURL: The address where your WordPress core files reside.
  • Site Address (URL) Or WP_HOME: The address typed in a browser to reach your WordPress blog.

These are the steps to follow :

Changing WordPress Site URL from Dashboard

1. Log in to WordPress admin panel and go to Settings > General.
2. Update WordPress Address (URL) line and Site Address (URL) lines with new URL and save the changes:

Changing Site url-General Settings

 

3. You will also need to re-generate the permalinks to make sure they have the new URL in  SettingsPermalinks.
So if you had a Post name, you need to switch to “Default” i.e select radio button in front of “Default” as shown in the following image, save the changes and then revert everything back:

permalink settings

 

If the Dashboard is not opening or not letting you in for some reason, you may perform the changes directly in the MySQL database.

 

Changing WordPress Site URL from phpmyadmin

Following steps will guide you on how to change WordPress website URL using phpMyAdmin in cPanel.

1. Login to your cPanel and navigate to phpMyAdmin menu in databases section:

phpmyadmin

Phpmyadmin

2. Choose the database which is being used for your WordPress site and click on it.

If you are not sure what exactly which database you need, check it in the wp-config.php file which is located in the document root – in our case, it is /public_html/wp/:

wp-config.php

Wp-config.php

3. Click on the wp-options table and edit siteurl and home fields:

wp-options table

                                                           Wp-options Table

 

Changing WordPress Site URL with wp-config.php file

This is the easiest way to modify your WordPress URLs. If you’ve moved your WordPress site or are trying to test it from a temporary URL, this also might be the only method that works for you.

Be aware of these settings in the wp-config.php file, if the ability to modify them from the dashboard is lost.

  1. From File Manager/FTP, Edit your wp-config.php file.
  2. Define your WP_HOME and WP_SITEURL settings by inserting these lines on the top:
define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );

That’s it!

Leave a Reply