Change WordPress URL Using MySQL
This Tool Can Help You When Changing Your WordPress URL
When Migration Seems Bigger Than Expected
If you’re changing your WordPress URL when moving a WordPress website, this can seem like a major task. There is actually a smooth, fast method to changing your WordPress domain with breaking image URLs or other asset URLs. Let’s get started with our change WordPress URL tutorial.
DISCLAIMER: REMEMBER BACKING UP YOUR DATABASE IS VITAL TO THIS PROCESS. WE DO NOT CLAIM RESPONSIBILITY FOR ANY DAMAGES YOUR SITE MAY ENDURE FROM USING THIS TOOL INCORRECTLY!
Step 1: Backup Your WordPress Site
Before you do anything major with your WordPress website, you should always create a complete backup. A complete WordPress backup includes everything inside the “wp-content” folder and the database that holds your WordPress data.
For more info see our tips on backing up WordPress.
Step 2: Locate Your WP Database Prefix
Every WordPress website has a database as you should already know by now. Your database is where your users, post content, image URLs, and other awesome data are stored.
For this change WordPress URL tool to work correctly, you will need to locate the database prefix. The WordPress database prefix is a unique identifier that is attached to each relative table in your database. (FYI, this is not our real database and we do not recommend posting your database, this is only for the change WordPress URL tutorial)
Taking a look inside your database, you will find tables named:
The example above uses a database prefix of “wp_”. Don’t forget your “_”, underscore after the letters of wp as it’s also part of your prefix.
Keep in mind that not all WordPress sites will have the default “wp_” prefix. WP database prefixes can use any letters or numbers to create prefixes. In fact, nowadays it’s highly recommended to have anything but default to better protect your database from hackers.
Step 3: Determine Old WordPress URL and New WordPress URL.
So chances are you made it to this tool because you want to change the URL of your WordPress site.
This part is fairly easy.
We need to know the URL that your site currently uses as that’s the “old” URL.
Then, you need the “new” domain/URL that you want your WordPress site to work on.
Let’s do a change WordPress URL example:
If I want to move EnsureDomains.com to EnsureHosting.com or even something as simple as EnsureDomain.com, Just to remove the “s” in domains.
EnsureDomains.com = “Old URL”
EnsureHosting.com = “New URL”
EnsureDomain.com = “New URL”
Again this is only an example for those a little confused.
Wait! Is your website secure???
Now we need to look a little closer at our URL structure. We need to focus on whether our URLs are secure or standard.
When you access your WordPress website, does your URL have “https://” before your domain name? If so your website essentially has some type of SSL attached.
If your domain doesn’t show https and instead shows http:// then you may want to consider buying an SSL for your WordPress site.
You can read more here about installing an SSL on cpanel.
Regardless, when changing your WordPress site URL you want to include that piece of the URL.
Let’s use our last change WordPress URL example:
https://EnsureDomains.com = “Old URL”
https://EnsureHosting.com = “New URL”
Or without SSL,
http://EnsureDomains.com = “Old URL”
http://EnsureHosting.com = “New URL”
Step 4: Use The MySQL Command To Change WordPress URL
Once you have your prefix, old URL and new URL, you can build your MySQL command. If you have never used this type of command, don’t worry it’s not as complicated as it sounds.
Let’s change our WordPress URL,
Assuming you have access to your databases, we need to go inside “phpMyAdmin”.
Now let’s dive into the database that our WordPress site uses. Once inside that specific database, you will get a few new tabs at the top.
Open the SQL tab, there you should find an empty white text/code box. That’s where the code goes you just created with this WordPress URL tool.
FINAL NOTICE: YOU SHOULD MAKE SURE YOU HAVE A COMPLETE BACKUP OF THIS DATABASE BEFORE GOING BEYOND THIS POINT!
Copy the snippet from this page and paste it inside the text area. Some phpMyAdmin accounts include a test run button that allows you to see if any results or “rows” even change, Others may not be as fortunate. When you are ready, you can press the GO button to search your database for your old URL and change it to your new URL.
If an error occurs we can empty the current database and re-upload our backup WordPress database. That’s why we have a database backup right?
Then you would need to determine where things went wrong.
Step 5: Check Out Your WordPress Url Change
Hopefully you have already pointed the new domain to this installation.
By now you should be able to access your WordPress login via the new URL.
Always start with logging into your dashboard after a complete URL change. It’s a straight forward way to ensure everything is functioning properly.
Final thoughts on changing WordPress URL using MySQL
Overall, our way to change WordPress URL using MySQL Tool can take less than 5 minutes. Doing a WordPress URL migration by hand can take hours. Save yourself the time change your WordPress URL using MySQL!
From Experience as a WordPress developer
As a WordPress developer, I build sites on development domains, local host servers, and subdomains. It really depends on the particular project and who’s involved. I use this snippet to ensure a smooth URL switch over when moving each WordPress site.
After writers and content folks get their job done, you could easily end up having 16,000+ links to change.
I’ll let you think about how long that could take.
This snippet takes that to about a 1.6sec request and we spend our time looking for things MySQL may not have been able to locate or change by chance.
All in all, with the snippet I can do the full WordPress URL change within 20 minutes and that’s including a thorough look through for possible misses.
Learn Basic Tricks To Website Ownership
Already have an account?