When using https, wordpress doesn’t use https for CSS and JS, and admin doesn’t work. How do I fix this?

So I recently, built and LAMP server and installed wordpress on it. I connected it to the web via a reverse ssh tunnel using serveo.net. I decided to add ssl and the rest of the website seem to work fine, but wordpress keeps breaking when I try to use ssl. I went to the general settings and changed the urls to http instead of https, but when I load the pages, in the source code the css and js urls are using http instead of https, so they won’t load. Then wp-admin part won’t even load. How do I fix this? I’ve looked at quite a few posts about people having similar problems, but none of them helped.

4 Answers
4

Check two things:

  • in the wp-options table, the site URLs (in two places) should be the full URL, as in https://www.example.com .
  • check the site’s htaccess file for proper rewrite of http to https.

For a htaccess rule, this one works in most case:

RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Then look at your theme files to ensure that any references to CSS/JS include the https protocol, not http. Most well-written themes will use relative rather than absolute references to files to include.

It’s also possible a plugin might be specifying http rather than https.

Use the Network tab in Developer Tools (usually F12 in your browser) to look at each request to see where it is coming from. If the request is to a plugin folder, then check the code in there.

Leave a Comment