Set up WordPress and Cloudflare to avoid a 301 error
Recently, I was launching a new site that was built with WordPress and uses Cloudflare for its SSL certificate. Seems like a fairly simple and common task but it led me to getting a 301 error. So what gives? Why was I getting a 301 error? And, more importantly… how did I fix it?
Long Answer
The site was built locally on my computer. I’ve been using Local WP which makes spinning up a new project easy. I’m on a Mac so it does have some issues with creating local SSL certificates. Here’s a great article on how to fix Mac SSL certificate issues from Local WP itself.
At first, I thought that was the problem. However, after getting the local SSL certificate working I still couldn’t migrate from development to production without getting an error. After lots of searching and reverse engineering the migration I found this thread on 301 errors with WordPress and Cloudlfare.
Short Answer
The short answer is… try uninstalling Jetpack on your production site. It’s likely the culprit.
I’m writing another article on how to integrate Jetpack so it doesn’t interfere with Cloudflare to give a 301 error. If it isn’t already linked in the previous sentence then be sure to check back soon to see the solution for that as well.