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.


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.

| improve this answer | |
  • I'm using the default theme. twentynieteen,I'm using the default theme. twentynieteen. The database entries are correct, but the head section has stuff like <link rel='stylesheet' id='wp-block-library-css' href='jtjumper.serveo.net/wp/wp-includes/css/dist/block-library/…' type='text/css' media='all' /> <link rel='stylesheet' id='wp-block-library-theme-css' href='jtjumper.serveo.net/wp/wp-includes/css/dist/block-library/…' type='text/css' media='all' /> – John Tippin Feb 3 '19 at 23:29
  • If I look at the page source on my test (hosted) site with the 2019 theme, the href for those statements includes the https: protocol. And I have the htaccess shown in my answer. And my wp-options table contains example.com , not just www.example.com . Perhaps yours is not set up that way? – Rick Hellewell Feb 3 '19 at 23:39
  • There's not enough space in the comments for the source but this is the link for the page jtjumper.serveo.net/wp my wp-options table has both, which are both https – John Tippin Feb 4 '19 at 0:06
  • 1
    Disable all your plugins (especially really simple ssl). Then set your htaccess as shown. Then run a search/replace plugin (I like "Better Search and Replace") and search for yourdomain.com and replace it with yourdomain.com . – Rick Hellewell Feb 4 '19 at 1:51
  • 1
    The search-replace string mentioned in the comment above should say: search for http://yourdomain.com and replace it with https://yourdomain.com - because of formatting, it id not show correctly in the comment. – SherylHohman Mar 1 at 23:09

Had the similar issue.

This answer solves most of the issues and I'm hoping you've gone through it.

The reason, I found, for HTTPS (SSL) not working on my Wordpress even after changing
1. Virtual Host File aka <web_directory>.conf file inside /ect/apache2/sites-available
2. wp-config file inside /var/www/<web_directory>/
3. [For AWS EC2 Users] Adding a load balancer with a SSL certificate for HTTPS connections

If after doing all this, you can view your website w/o CSS and JS working, then,

Last step

  1. Inside your Wordpress Dashboard, go to Settings>General

    Under, Wordpress Address (URL) add, https://<yourdomain>.com
    Under, Site Address (URL) add, https://<yourdomain>.com

I found that, when only Site Address (URL) has been activated with the website URL, Wordpress Themes automatically direct towards, the css files with HTTPS aka, https://<WordPressAddress>/css/index.css.

Only your domain has SSL access hence, adding your domain name at Wordpress Address (URL) solved the problems for me.

| improve this answer | |

Add this code to wp-config.php in your wordpress root folder.
Also, in General Settings on the Admin Panel, change http to https for your siteurl an home.

define('FORCE_SSL_ADMIN', true);
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
| improve this answer | |

I had the same issue when I hosted my site on Azure webapp service Linux.

Try this plugin. take care when it active it works. https://wordpress.org/plugins/jsm-force-ssl/

This plugin uses native WordPress filters, instead of PHP’s output buffer, for maximum reliability, performance and caching compatibility (this plugin does not affect caching performance), along with 301 permanent redirects for best SEO (301 redirects are considered best for SEO when moving from HTTP to HTTPS).

Honors proxy / load-balancing variables for large hosting environments:


Your web server must be configured with an SSL certificate and able to handle HTTPS request. 😉

Simply activate the plugin and you’re done:

There are no plugin settings to adjust, and no changes are made to your WordPress configuration — simply activate or deactivate the plugin to enable / disable the filters and dynamic redirects.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.