Migrating a WordPress blog to Netlify as a static site

In this article: How I moved several of my WordPress blogs from shared hosting to Netlify as static sites. Article was written June 2024.

I have a collection of WordPress blogs dating 10+ years back. They are all on a shared host who keeps raising the cost to renew. The sites are old and they don’t get many visitors, but rather than take them down I decided to turn them into static sites that are simpler to maintain and less expensive to host.

It is not a difficult process, and I documented all the hiccups I encountered along the way in this guide.

Pre-reqs

You have:

  • WordPress site hosted on shared hosting (like Bluehost, Siteground, etc.)
  • Your own domain (optional, but this guide assumes you do)
  • About 2 hours of time

You want:

  • Less expensive hosting (Netlify has a free tier that can handle small static sites)
  • A faster, simpler, and more secure live WordPress site

You can tolerate:

  • A new workflow for your WordPress site – you will run your site from your own computer, make edits on that version, and then “publish” a static version of your site to Netlify
  • A simpler “live” version of your site – you can’t have any kind of user interaction like user accounts, comments, or shopping carts
  • Some debugging – none of my sites came over with 0 problems

Step 1: Export your WordPress site as a .zip

Log into your WordPress site, install the “WP Migrate Lite” plugin, and export your site. The purpose of this step is to create a .zip file containing everything needed to run your site locally (on your computer).

There are a number of options in this plugin’s config.

I use:

  • Database – leave as defaults
  • Media uploads – take all
  • Themes – export just the ones I use
  • Plugins – export all
  • Must-use plugins – export all
  • Other files – export all
  • WordPress Core Files – yes, all

Click the “Export” button and wait for it to generate a .zip file. Hopefully it works. If it does not, you may need to adjust what you export or do the old WordPress standard of turning off plugins one by one until it works.

You should leave your actual site up and running. (In fact, your original site can stay up through this entire process.)

Step 2: Import your WordPress site to Local

I use Local to run my sites on my own computer, and Local has versions for Windows, various flavors of Linux, and Intel and Apple Silicon Mac so hopefully it works for you, too. It’s free.

Click the “+” button to import your site.

Import the .zip file you downloaded in Step 1.

For me, going with the “Custom” environment that it autofills for me has worked so far.

Fix the SSL certificate

The site won’t fully “work” until you approve its SSL certificate. The main page might load but images won’t and you’ll have an annoying banner across the top like so.

On my Mac, I follow these steps: https://localwp.com/help-docs/getting-started/managing-local-sites-ssl-certificate-in-macos/

Clicking “trust” in the SSL section of the site’s Overview tab in Local usually spawns this red banner across the top.

I open Keychain Access and find the untrusted certificate that was generated.

I set the local site to “Always Trust”.

I go to Chrome and explicitly type https://sitename.local and confirm it loads. At this point, the homepage loads but the links don’t work.

I am ready for the last step – opening the Local shell and running this script.

Run this script:

wp search-replace 'http://yoursite.local' 'https://yoursite.local'

Success looks like this:

Sometimes I get a message about flushing the cache, which I do with wp cache flush.

Now I go back to Local and open the site admin page. If you get a security error, try opening the page via the WP Admin button.

I don’t know why, but Local never seems to know that my site is secure (and it keeps serving me the insecure version) until I actually log in as my admin account. Sometimes it still doesn’t work, so I go back and trust the certificate again. Some combination of restarting the site, trusting the certificate, and logging in as admin eventually gets it all working.

Do not leave this step until you have clicked around your .local site and verified images and links are working and the URL is the secure version.

Step 3: Get Netlify ready to receive your site

If you haven’t, head over to netlify.com and create an account. Look for “Add new site” and choose “Deploy manually”.

This step assumes you have something to upload, and you’ll be stuck here until you give it something.

Just feed it something simple – I upload a folder (name doesn’t matter) containing index.html (name and extension do matter).

Now you have a Netlify site!

Go to “Site configuration” (on the left) and copy the “Site ID” somewhere.

You will also need your Netlify OAuth token, which is created by going into your own personal settings in Netlify.

Copy this string somewhere safe, too.

You should now have:

  • a site ID
  • an OAuth acess token

Step 4: Publish your site using Staatic

Go back to Local, load up yoursite.local, and install the Staatic plugin. Once installed and activated, open the Deployment tab and fill in your Netlify Access Token and Netlify Site ID (and don’t mix them up). Save changes.

Go to Staatic -> Publications and attempt to publish to Netlify.

The publish step is, unfortunately, where I usually spend most of my time. Here are some of the issues I’ve encountered:

Self-signed certificate is making the crawl fail

Crawl ‘https://yoursite.local/‘ rejected (cURL error 60: SSL certificate problem: self signed certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) 

This one’s easy – go into Staatic’s advanced tab and check the “Downgrade HTTPS to HTTP while crawling site” checkbox.

“Too many redirects” on Netlify after deploying


One of my sites gave me a lot of trouble: the publish was a success, the deploy appeared to be a success, but visiting the deployed page on Netlify gave me this “ERR_TOO_MANY_REDIRECTS” page.

Reader, I spent hours on this problem. It wasn’t any of these things:

❌ uninstalling W3 Cache and other plugins
❌ reinstalling the Staatic plugin
❌ cleaning up all the URLs that were creating a redirect entry in the Resources tab

And there’s some evidence of it here in the Publication’s own “Resources” tab – where is it coming from? What is it??



✅ I fixed it by going into WordPress’s Customize page menu and making my homepage NOT a static page. Choose “your latest posts” and publish again.

I honestly think this is a bug with Staatic. 🐛

If your WordPress site is using a Page as its homepage, Staatic inserts a redirect from “/” to “/” into the netlify.toml file like this:

[[redirects]]
from = "/"
to = "/"
status = 301
force = true

This redirect is not present if you choose “Latest posts” for your homepage. A website published with “Latest posts” also does not include that weird redirect in the Publication’s “Resources” tab.

I only discovered this because I had the idea to download the entire site from Netlify (it’s in their UI somewhere), remove the from = “/” to = “/” redirect, reupload, and see if the site looked any different. It did – I could see my site! But instead of my homepage, I had this embedded 404.

That gave me the idea to adjust the content of my homepage, which WordPress surfaces in Appearance -> Customize -> Homepage Settings. I spent some time toggling between “Static Page” and “Latest Posts”, publishing, and observing the .toml file each time.

TL;DR – Using a static page for your homepage will cause Staatic to insert an endless redirect. If you have a redirect loop on your static WordPress site, try it with “latest posts” as your homepage instead.

I guess that’s what you get from a free plugin. (Hope this helps someone)

Step 5: Change your domain’s nameservers

In this step we are going to make yoursite.com point at your Netlify deploy.

Confirm that you are happy with what’s been deployed to https://yoursite.netlify.app because this step will hook your domain up to the Netlify deploy and start sending visitors to your static site.

Compared to what came before, this step is easy.

In Netlify, click “Domains” in the side panel.

Click “Add or Register domain”. Put your domain into this box and click Verify.

Of course it’s already registered – you own it. Click “Add domain”.

I click through the “Add DNS records” step and get to the final step:

Log into whoever you registered your domain with and update your nameservers (follow their docs for help).

Step 6: Wait for DNS and add a Let’s Encrypt! certificate

Back in Netlify, you’ll see:

It usually takes about 10 minutes for the domain change to propagate. When it’s ready, add a security certificate. (Bottom of the “Domain management” section).

Here’s what success looks like – if it fails, it might be that the propagation hasn’t finished yet.

Confirm your site looks good at yoursite.com and then deactivate the version hosted on your prior host.

Step 7: Other things you might want to do (or know about)

Google Search Console: Since you moved hosts, you will probably have to redo your verification with Google Search Console.

Log into Search Console, and add or update your site. Get the TXT code and add it to your site in Netlify as a DNS record of type “TXT”.

Backups: Your static site can’t run an automated backup plugin, so you’ll want to do it yourself from your local machine. I use Updraft and I publish the backups to Google Drive. Since the blogs I turned into static sites don’t get updated very often (if at all), I don’t mind running the backup manually after I make a change.

All your plugins and your WordPress install are no longer going to automatically update on their own. Your static site is like a “render” or an “export” – it doesn’t have all the plugins running 24/7 doing automated backups. You’ll have to open Local, run your site, and update plugins/WP yourself.

Hope this helps someone – happy blogging!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.