0

Today I tried to load one of my local WP sites to prepare for developing a new theme and found that none of the assets were loading. I checked the paths and found that they show as expected in the page source:

http://localhost/jessefivey.com/wp-content/themes/fivey/style.css

but when I actually clicked on the link, the protocol changed to https:

https://localhost/jessefivey.com/wp-content/themes/fivey/style.css

I don't have a local SSL certificate, so all assets are failing: stylesheets, images, scripts, etc. The Wordpress PHP templates load with no problem but everything else fails.

I have about a dozen local WP sites and this is happening with three of them, on the frontend and the backend; the only connection between them is they were the first three sites I checked today, but I've cleared my cache and the problem persists.

What could be causing a redirect to https on assets only? All my local sites have always only used http, and the broken sites were working fine before today!

(An extra detail: in Chrome, I can select the option to load insecure content per domain and this immediately fixes things; in Firefox, my primary browser, clicking this option doesn't do anything and I can't get past the warning screen.)

(ETA another detail: When I check the details of the certificate error, there is actually a certificate loading, but the browser doesn't trust it for probably obvious reasons. I would like to fix the redirect but I would settle for getting the local certificate to work if all else fails.)

(ETA another thing I just discovered: one of the broken sites, in addition to redirecting to https, is removing "siteurl/wp-content/" from asset links when clicked, redirecting to something like "https://localhost/themes/themename/style.css" which gives a "not found" error after setting a security exception for the domain. The other two do not show this behavior, which might mean this site is having a slightly different issue?)

(ETA: if I change the directory name of the main broken site (jessefivey.com to jessefivey.old) and update the database to reflect the new domain, I still get the redirect problem. If I make a NEW local domain jessefivey.com and install WP from scratch, I ALSO get the redirect problem on the new site, but it goes away if I clear my cache. This makes me think it has something to do with WP settings in the DB or in wp-config, but I still can't find anything!)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.