How to Change the URL of any WordPress-Powered Website

By | December 16, 2023

WordPress makes website building fun, fast and seamless. This is why about 40% of the total websites in the world are powered by WordPress. Some of the features that make WordPress stand out from other website builders include its community, open-sourced codes and frequent updates that introduce new features to the system.

Today, we shall be discussing how you can change the website URL of any WordPress-powered blog or website. The URL stands for Universal Resource Locator and it helps you locate a resource on the World-Wide Web (WWW). This guide can come in handy if you need to change your www URL to a non-www URL or vis-a-vis.

There are three ways you can make this happen. The first is from the wp-admin dashboard, the second is by adding a code snippet to the wp-config.php file and the third can be effected through the database.

CHANGE THE WEBSITE URL FROM THE WP-ADMIN DASHBOARD

If you are not too knowledgeable in web development, the best way to go about changing your website URL is from the wp-admin dashboard.

Once you are logged in to your site at https://yoursite.com/wp-admin, navigate to Settings > General in the dashboard menu and edit the existing URL in the WordPress Address and Site Address fields to your taste.

CHANGE THE WEBSITE URL FROM THE WP-CONFIG FILE

If you have no access to the wp-admin dashboard of the site or are quite knowledgeable in web development, you can apply this method. Go to the root directory of the website in the hosting CPanel. This is usually achieved through the file manager or an external FTP software. You can also access the root directory of the URL through the Domains section on your CPanel.

Locate the wp-config.php file and right-click for more options. Select to edit the file and add the code below to the file.

define('WP_SITEURL', 'https://www.yourwebsite.com');
define('WP_HOME', 'https://www.yourwebsite.com');

Remember to replace the yourwebsite.com instances with your domain name and save the file. It should now be updated in your dashboard. Please note that using this method renders every other method useless as it would be impossible to edit the URL from the WordPress dashboard any longer. Also, updating your website URL from the database won’t be effective until the snippet of the code above is removed from the wp-config.php file.

The option to edit the URL is greyed out because of the code added to the wp-config.php file

CHANGE THE WEBSITE URL FROM THE DATABASE

In the CPanel hosting of your website, locate PHPmyAdmin and open it. In most cases, you would be redirected to the database section in a new tab. Once it is fully loaded, locate the website’s database, scroll through to the wp_options table and open it.

In your case, it may be a different prefix depending on the prefix assigned to the database during configuration. It could be wpeg_options or anything else but options would be in the table name.

Double-click on both the WordPress address and website address fields to enter a new URL value for the website.

Boom! You have finally changed the URL of your WordPress-powered website. Let’s address some questions you may be having…

What is the difference between the WordPress Address and the Website Address?

The website address is what you want to define as the homepage of your website while your WordPress Address is where you want to host your themes, plugins and other WordPress dependencies. In most cases, you would be required to enter the same value to avoid conflicts on your server.

Why do I Get a redirection to a different URL after changing my website URL on WordPress?

This happens primarily when your website is hosted in the root folder of a domain name different from the URL you set on WordPress. It could also be a result of the snippet added to the wp-config.php file. Check if the URL defined there is your target URL.

If you have further questions regarding the subject, kindly use the comment section and I will take my time to respond to your queries.

Thanks for visiting and reading. Have a great day.

Leave a Reply

Your email address will not be published. Required fields are marked *