How to Replace http with https in phpmyadmin (bulk WordPress URL update)

WordPress find and replace HTTP with HTTPS using phpmyadmin

Hey there! Some links on this page may be affiliate links which means that, if you choose to make a purchase, I may earn a small commission at no extra cost to you. I greatly appreciate your support!

If you’re okay with executing a few MySQL queries, you can quickly find and replace any URL in your WordPress MySQL database. In this tutorial, you’ll learn how to use phpmyadmin to replace HTTP with HTTPS.

Find HTTP Occurrences

The first thing to do is find all occurences of URLs that start with HTTP in your WordPress database. To do this, sign in to phpmyadmin and click on your database on the left side.

In the Search tab, enter your HTTP domain name surrounded by the wildcard character %.

%http://www.example.com%

It’s also good to search for the non-www version of your website too.

%http://example.com%

You’ll see a table of matching row similar to this.

Search results in phpmyadmin show HTTP urls

Our goal is to eliminate any matches from the search results. To do this, we will execute an SQL query to replace HTTP with HTTPS for each table.

Replace HTTP with HTTPS in phpmyadmin

Now that we know how many URLs start with HTTP, we can begin to replace them with HTTPS.

First click on Browse for one of the matching tables in the search results from above and find the column or columns that contain HTTP URLs.

Next in the Query tab (it’s a good idea to open another window), copy the following SQL query and replace t with the name of the table and col with the name of the column containing HTTP URLs. Also replace example.com with your domain name.

UPDATE t
    SET col = REPLACE(col, 'http:', 'https:')
    WHERE col LIKE '%http://example.com%';

For example, in the search results above, if I found URLs that start with HTTP in guid column of the the wp_posts table, my MySQL query would look like this.

UPDATE wp_posts
    SET guid = REPLACE(guid, 'http:', 'https:')
    WHERE guid LIKE '%http://tonyteaches.tech%';

You can first Simulate query to see how many rows will be replaced and finally hit Go to execute the query.

Repeat this process for each table that has occurrences of HTTP URLs. You re-run the search query to keep track of your progress along the way.

Here is a video that will walk you through the process.

YouTube video

If you have any questions, please let me know in the comments section below.

Facebook
Twitter
Pinterest
LinkedIn
Reddit

Meet Tony

Tony from Tony Teaches Tech headshot

With a strong software engineering background, Tony is determined to demystify the web. Discover why Tony quit his job to pursue this mission. You can join the Tony Teaches Tech community here.

2 Responses

  1. This worked perfectly for me for the first folder of matches but when I go through the same process in other folders I can see the matches and employ the same query but when I simulate the query it says there’s 0 matches, even though I can see them in the window I’ve just searched them in. Do you have any insight into this working and then suddenly not? Thanks!

Leave a Reply

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