Local wp http redirects to https

What issue or error are you experiencing?

Learning to use GatsbyJS with WP, I run npx gatsby develop and receive an error:

ERROR #gatsby-source-wordpress_111002 PLUGIN

gatsby-source-wordpress Error: self-signed certificate

If I edit the site and home URL in db manager to use http instead of https, the site will still redirect to https.

Trying:

define( 'WP_HOME', 'http://gutenberg.local' );
define( 'WP_SITEURL', 'http://gutenberg.local' );
define( 'FORCE_SSL', false );
define( 'FORCE_SSL_ADMIN', false );

makes no difference.

How do I load a local WP site on http without it redirecting to https, please?

When you updated the URL with the DB manager, it’s possible that it didn’t get all of the references to https.

One thing to note about urls within a WP database is that there isn’t anything that’s relative – ie, you can’t define a base url and have all the various pages be relative to it.

When I’m updating urls in the DB, I usually will use wpcli in the site shell. Click “Open site shell” and in the resulting terminal, you can search for instances of the old url with https and replace it with the regular http version. Note that I don’t have a slash at the end as that will usually pick up more hits within the db:

wp search-replace '<old-url>' '<new-url>'
wp search-replace 'https://example.local' 'http://example.local'

Hi Ben,

How do I open site shell?

Hey @SRD! If you look at Ben’s screenshot above, underneath his site name Alex Test, you’ll see the options for Site Folder and Site Shell. These should be the same on your application as well!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.