0

I have a website: https://media.example.com/blog/

And I want to change into: https://www.example.com/blog/

I made this transformation in the Wp-DB on the table wp_options, i modified the fields: siteUrl and Home...

Now, after restarting Apache server, I cannot load the Theme Css and Js. also, while before I was loading all the Css and Js under href='https, now they are loaded under href='http.

I read different blog/solutions... https://wordpress.org/support/article/changing-the-site-url/ SSL Breaks Wordpress CSS https://wordpress.org/support/topic/css-broken-after-moving-to-test-subdomain-without-ssl/

but I'm little confused becasue it looks that there is not a unique common solution.

1
  • 1
    When you change a site's URL you really need to use a database migration plugin. WP serializes URLs in a lot of different tables, so CSS and JS not loading are a symptom of a larger problem.
    – WebElaine
    Commented Feb 24, 2020 at 19:32

2 Answers 2

1

I'd use a "Search and Replace" plugin (I like "Better Search and Replace") to search for all http://www.example.com and replace with https://www.example.com . That will fix media URLs, for instance, and other settings.

It could also be that your theme is calling http resources rather than https. You could look in the Developer screen (F12 in your browser usually) at the Network tab to see what http (vs https) resources are being loaded, and use that info to find the source code that is using http instead of https.

Backup your database first, of course, although I've had no problems with the "Better Search and Replace" plugin.

2
  • I don't know if it will work. I got my site on one server and I have to redirect everything on another server/domain...
    – Giuseppe
    Commented Feb 25, 2020 at 14:18
  • You can use htaccess directives to take care of http to https, and redirect to another domain that runs on another server. You'll still need to do a search/replace in the database, but once that is done (with an htaccess that rewrites to https), all should be well. Commented Feb 25, 2020 at 19:04
0

Ok... I found this plug in https://wordpress.org/plugins/ssl-insecure-content-fixer/

My site is also behind a load balance and this plugin solved everything. It's running in real-time (I don't like that), but it keeps everything under control

1
  • All that plugin does is a bunch of add-filters and add-actions to change requests from http to https. Which is what a search/replace plugin will do for any URL in the database. Add a simple http-to-https htaccess directives to rewrite requests to https and you don't need the plugin's overhead. Commented Feb 25, 2020 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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