Web Design, Hosting, Digital Products & Services
Changing WordPress Site URL In Database using Command-line
- Start Making Money Online
- Dominate In All Devices
- From Start To End Solutions
- The Ultimate e-Commerce Experts
- Learn To Manage Your Business Online
- Stand Out From The Crowd
Join, Ready, Write & Share !!!
Contact Us,
For A Free
Consultation !!!
How To Change the WordPress Site URL In Database using Command-line
How Can WordPress URL Change Be Done?
- 1. Using the admin area
- 2. Using the functions.php file
- 3. Using the wp-config.php file
- 4. Using the phpMyAdmin database
- 5. Using the MySQL database
Many users find it difficult to change the WordPress URL, and this is a task that will be necessary at some point. However, there are ways to make the change beyond the Administration area. Editing the “functions.php” and “wp-config.php” files are some of the recommended ways.
The URLs added to the WordPress platform are addresses that deserve attention, as they are directly related to the management of blog files and how your business appears in search results performed on the internet.
Based on this, changing the WordPress URL may be necessary at various times. The question is, do you know how to do this?
We have developed an exclusive walkthrough to help with this task. So, enjoy the tips below!
How to Access the WordPress Database
There are a few different options when it comes to accessing the WordPress database. The method or methods available to you will largely depend on the type of WordPress hosting you will be using. If you’re not sure how your server is configured, talk to your hosting provider or systems administrator. Either way, options may include:
1. phpMyAdmin
phpMyAdmin is one of the favorite tools as it allows us to connect to the database through a web-based GUI. It needs to be installed on the same server that hosts the database, although many hosting providers offer phpMyAdmin separately.
2. Plesk/cPanel
Plesk and cPanel are two control panel platforms that serve similar functions: a user control interface that facilitates server management. Of course, there are important differences, including the technologies and operating systems they support. Anyway, they also allow us to access databases, albeit in slightly different ways.
About Black Pearl Matrix
We are a passionate team of experts that have helped businesses large and small from all around the world to capitalize on the Internet.
BPM Professional Web Design, Online Business Development, Pre-Built Online Stores, Mobile Apps, SEO Services, Web Hosting, Interactive Media & Animation, Social Media Integration, Branding, Affiliate Opportunities, Online Store
Featured Articles
01. AFFILIATE MARKETING
8 Advantages of Affiliate Marketing In 2022
- March 02, 2022
- 8:15 am
01. AFFILIATE MARKETING
8 Advantages of Affiliate Marketing In 2022
- March 02, 2022
- 8:15 am
01. AFFILIATE MARKETING
8 Advantages of Affiliate Marketing In 2022
- March 02, 2022
- 8:15 am
01. AFFILIATE MARKETING
8 Advantages of Affiliate Marketing In 2022
- March 02, 2022
- 8:15 am
3. SSH/MySQL/mariaDB client
SSH is a less user-friendly way to connect to a database, offering a CLI (command line interface) instead of a GUI. Therefore, a deeper understanding of SQL commands is recommended. SSH needs to be explicitly configured on the same server hosting the database before connecting to it.
4. Plugins
You can also use WordPress plugins to access your WordPress database. Using a plugin you can also access the bank directly from your WordPress admin. Here, you will need to choose a plugin from a reputable provider and follow applicable best practices to keep your data safe. If you’re not sure which plugin to use, read our guide on choosing the best plugins for your WordPress site.
Why is it Important to Know How to Change WordPress URL?
Many blog and website owners like a URL that is easy to remember and directly related to their website content. Changing your WordPress URL is an effective way to increase your brand relevance and get a better experience. Also, sometimes default WordPress URLs need to be changed for technical reasons.
Here are some of the top reasons why you should know how to change WordPress URL:
• Search Optimization:
A URL that is directly related to the content on your site can help improve your search engine rankings by telling search engine tools what your site is about.
• Easier Access:
When you customize the URL, users will more easily find the content you want them to access.
• Improved User Experience:
A custom URL can help improve the overall impression your users will have of your site as they will feel more comfortable sharing it, which will result in greater reach.
• You have full control over the URL:
You can change the WordPress URL information as needed, for example when you change the post name.
• Effectiveness:
A relevant URL allows users to share your content more effectively to your potential customers by helping them quickly understand the site’s content.
Therefore, changing WordPress URL is essential to improve user experience and improve search engine ranking. Furthermore, it also helps to make the URL more meaningful, easy to remember and easy to share with others.
How to Change WordPress URL?
Now that you know the importance of knowing the process, we have separated 3 methods that should help you change the WordPress URL faster and easier.
Check out the steps below!
Method 1: Using the admin area
This is the easiest method to change WordPress URL. However, not everyone has access to the Administration area. If this is not your case, go to the platform and, in the “Dahsboard” column, click on “Settings” and “General”.
Now just click on the “WordPress Address” and “Site Address” fields and change the URL. Usually, both fields have the same address. Finally, click “Save Changes” to confirm the changes and type the new website or blog URL into your web browser to test.
Method 2: Using the functions.php file
If you don’t have access to the WordPress Admin area, this will be the best way to change your URLs, as it’s the second easiest. Then, access the platform website using an FTP Client, click on “wp-content”, “themes” and “your-theme-folder”.
In the list of files that will appear, locate one with the name “functions.php”, click with the right mouse button and select the option “View/Edit”. Use a plain text editor such as Notepad or TextEdit to do this. Then add the following codes at the bottom:
• update_option( ‘siteurl’, ‘https://example.com’ );
• update_option( ‘home’, ‘https://example.com’ ).
Replace the word “example” with your blog or website domain name. Now, all you have to do is save your changes. A copy will be created on your computer and you will have to upload the file with the changes in the same place where it was hosted.
The advantage of this method is that it updates the URLs directly in the platform’s database. Then, to see if the change worked correctly, type the new URL into your computer’s web browser and hit “Enter” on your keyboard.
WEB DESIGN PLANS
MARBLE PLAN
- Blog Website
- Up To 3 Pages
- Responsive In All Platforms
- 6 Months Support
- And much more ...
PEARL PLAN
- Corporate Business Website
- Up To 5 Pages
- Emailing Contact Form
- 8 Months Support
- And much more ...
PLATINUM PLAN
- E-Commerce Store
- Up To 30 Products
- Security Payment System
- 12 Months Support
- And much more ...
VISIT OUR STORE
VISIT OUR STORE
Method 3: Using the wp-config.php file
This method is similar to the previous one, only a little more complex. Therefore, it is only recommended to use it when you cannot find the “functions.php” file.
To start the process, access the WordPress website using an FTP Client and locate the “wp-config” file. It is located in the root folder of your website.
After opening the file, above the line that says “That’s all, stop editing! Happy publishing”, add the following codes:
• define(‘WP_HOME’, ‘https://example.com’ );
• define (‘WP_SITEURL’, ‘https://example.com’ ).
As with method 2, replace the word “example” with your website’s domain name, save the changes and upload the new file to the original hosting location, replacing the previous one. Now, visit the site and see if the changes worked.
How to Change WordPress URL Using phpMyAdmin Database
If none of the previous steps work, you can change the WordPress URL by directly accessing the platform’s database. However, if you prefer this method, it is recommended that you back up your files first to undo the changes in case something goes wrong.
To get started, go to your web hosting provider’s Dashboard and click on the “phpMyAdmin” icon. It is located in the “Database” section. Doing so will open a screen that will allow you to make changes online.
Within the “phpMyAdmin” interface, you must click on “WordPress Database” in the left column, so a table with the necessary files will be displayed. Use the scroll bar until you find the “wp_options” file and click on it.
Now, locate the lines named “siteurl” and “home” in the “option_name” column. Then click on “Edit” (pencil icon) to change the two lines in the “option_value” column. After that, click on the “Go” button in the lower right corner to save the changes made. Finally, go to the website to test the changes.
Changing WordPress Site URL in MySQL Database
If you want to change the URL of an existing WordPress site from a MySQL database on the server, you can do this using the command line. This is a simple task but needs to be done manually. You will need to login to your server, usually using a file sharing program like FileZilla, and follow these steps:
1. First, you will need to connect to your database. This means accessing your server’s terminal (a program that allows you to run various commands) and using the following command where `your_server`, `your_username` and `your_password` should be replaced by the respective values:
mysql -h your_server -u your_user -pseu_password
2. Once connected, choose the WordPress database on your server that you want to change. To do this, run the command:
USE your_database;
3. Now, you can change the existing URL by running:
UPDATE your_table SET url_option = ‘new_url’ WHERE key_option = ‘siteurl’;
For example, if you are using the default WordPress table prefix (wp_), the command would be:
UPDATE wp_options SET option_value = ‘new_url’ WHERE option_key = ‘siteurl’;
4. Don’t forget to replace `new_url` with the updated URL address you would like to use.
VISIT OUR STORE
VISIT OUR STORE
5. Lastly, execute the `QUIT` command to exit the server. This will ensure the changes are saved.
Knowing this, now take a look at how to back up your data in case you make a mistake, this will ensure that you do not lose your data, check below:
In conclusion, running commands from the MySQL command line is a great way to control the WordPress database. In that case, just change the site path and save the changes, which will save you a lot of setup and maintenance time.
FAQ – Frequently Asked Questions About Changing WordPress Site URL in Database Using Command Line
1. What settings do I need to keep in mind before running the command?
2. What happens if I run the wrong command?
3. Are there any security risks when running the command?
4. Can I revert changes made to the database?
Conclusion
See how easy it is to change the WordPress URL in the database using the command line? In this article, we present all the necessary steps to update the WordPress URL and the respective commands in the MySQL database.
Using the database can save you a lot of time and effort if you want to make some changes to your website. We hope this guide is useful for you and helps to save you time.
Please Send Us Your Feedback
Did you like this article?
If so, help us by using the buttons below to share this article on social media.
Also, if you have questions or suggestions, send us a messages to help us improve this content.
THANKS !!!
Black Pearl Matrix ® Web Design, Programming, Digital Products & Services.
Featured Articles
01. AFFILIATE MARKETING
8 Advantages of Affiliate Marketing In 2022
- March 02, 2022
- 8:15 am
01. AFFILIATE MARKETING
8 Advantages of Affiliate Marketing In 2022
- March 02, 2022
- 8:15 am
01. AFFILIATE MARKETING
8 Advantages of Affiliate Marketing In 2022
- March 02, 2022
- 8:15 am
01. AFFILIATE MARKETING
8 Advantages of Affiliate Marketing In 2022
- March 02, 2022
- 8:15 am
01. AFFILIATE MARKETING
8 Advantages of Affiliate Marketing In 2022
- March 02, 2022
- 8:15 am