How to Change Website URL Without Accessing the wp-admin Panel

How to Change Website URL Without Accessing the wp-admin Panel

It’s not so odd when you aren’t able to log in to your WordPress admin panel, sometimes, a plugin or a wrong setting can be the reason.

In such a situation, you need to check the site’s URL, and as you don’t have access to the dashboard, you need to follow other methods.

For a WordPress beginner, dealing with the core files of a WordPress website can be a little bit tricky, but I am going to walk you through a few straightforward methods.

You would be happy to know; you can change the website URL from your MySQL database. In this tutorial, I am going to cover three different ways to update the site URL.

Two of the methods use cPanel, and one is dependent on the developer skills you have. Let me start.

Use the wp-config.php File to Update the Website URL

You may have known that .htaccess and wp-config.php are the two most important files of a WordPress site. Learning about such files is vital.

The wp-config.php is responsible for building a connection with the website’s data and its database; it consists of all the log in information in the encrypted form.

I hope you know how to edit the file. Follow the steps.

Step 1:

Login to your cPanel account and open the file manager. I am sure; you find it familiar.

How to Change Website URL Without Accessing the wp-admin Panel

Step 2:

Make sure you’re in the public_html directory by navigating to it from the left-hand sidebar of cPanel. Search for the wp-config.php file and right-click to edit.

How to Change Website URL Without Accessing the wp-admin Panel

If you host multiple websites on the same server, you have to find the folder name of your domain and open it to edit the wp-config.php file.

For a primary domain, public_html is the location to search into.

Step 3:

– Add two lines of code and save changes.

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

Don’t forget to replace the site name with yours. If you don’t want to use cPanel, you can also access the file via FTP.

Use the MySQL Database to Update Settings

As you know, the database consists of the information about you, your login credentials, and everything related to your WordPress website.

All you need is to search for the correct database table and edit the site URL. Let me explains how.

Step 1:

Open the phpMyAdmin from your cPanel account. You can find it under the Databases’ section.

How to Change Website URL Without Accessing the wp-admin Panel

Step 2:

Choose the name of the database from the left-hand sidebar and open the wp_options database table.

How to Change Website URL Without Accessing the wp-admin Panel

Step 3:

Search for the siteurl and home rows, click edit to modify the URLs. You can see a box in front of option_value to fill in the URL.

How to Change Website URL Without Accessing the wp-admin Panel

Click on the Go button to save settings.

It’s as simple as that. Repeat the same editing process for home, and you can see new URL of your website running.

NOTE: It’s important to note that you shouldn’t change the URL until you learn when to change.

This method is also complete. Now, you require to understand the concept of using WP-CLI.

Use WP-CLI to Change Website URL of a WordPress Website

First of all, you need to understand that it’s a techie method, which is for developers. For a non-techie user, it can be hard.

Today, I am only providing you the WP-CLI command to update the URL. Before that, you need to learn how to use it.

Many web hosting companies offer access to SSH, which is used to the command line. If you’re afraid of the black window, you may consider using other two methods.

If you have learned to use WP-CLI, let me show you an example of the command.

wp option update home 'https://yoursite.com'
wp optionupdate siteurl 'https://yoursite.com'

Don’t forget to replace the website name with your site name. I hope you know what you’re doing. Run the command to accomplish your task.

Conclusion

Depending on your expertise and the choice, you can pick any of the methods. If you have access to the wp-admin panel, you can directly navigate to Settings>>General and change the URLs.

Using the wp-config.php is one of the most convenient ways because you can either access it using cPanel or FTP server.

WP-CLI can be used only by expert WordPress users.

Check out these top 3 WordPress hosting services:

A2 Hosting
£1.51 /mo
Starting price
Visit A2 Hosting
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.8
  • Pricing
    4.0
IONOS
£0.77 /mo
Starting price
Visit IONOS
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.3
Hostinger
£2.31 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
    4.7
  • Support
    4.7
  • Features
    4.8
  • Reliability
    4.8
  • Pricing
    4.7

How to Fix Image Upload Issue of Your WordPress Website Using FTP

This how-to guide explains the cause and solution of image upload error for a Wo
3 min read
Bruno Mirchevski
Bruno Mirchevski
Hosting Expert

How to Deactivate All Plugins Using phpMyAdmin

This how-to guide explains the easiest way to deactivate all plugins using an SQ
3 min read
Bruno Mirchevski
Bruno Mirchevski
Hosting Expert

How to Solve "Maximum Execution Time Exceeded" Error of a WordPress Website

This how-to guide provides the solution to fix Maximum Execution Time Exceeded e
3 min read
Bruno Mirchevski
Bruno Mirchevski
Hosting Expert

How to Fix an HTTP Error Appearing in the WordPress Media Library

This is an article which will help you solve the HTTP error you get in the media
3 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top