Reputation: 1131
I installed a new version of wordpress on a server web running under https.
I changed the two siteurl and home options value to my https://mysiteweb.com
I added the following value into my wp-config.php
define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content' );
define( 'WP_CONTENT_URL', 'https://mysiteweb.com/wp-content' );
define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/wp-content/mydir/plugins' );
define( 'WP_PLUGIN_URL', 'https://mysiteweb.com/wp-content/mydir/plugins' );
Bu I still the same error for all css and javascript file loading:
Mixed Content: The page at 'https://mysiteweb.com/' was loaded over HTTPS, but requested an insecure script 'http://mysiteweb.com/wp-includes/js/wp-emoji-release.min.js?ver=5.4.2'. This request has been blocked; the content must be served over HTTPS.
Upvotes: 1
Views: 2624
Reputation: 825
I explored the file wp-config.php
and found:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
$_SERVER['HTTPS'] = 'on';
}
set X-Forwarded-Proto
as https
. If you are using nginx the configuration can be:
server {
listen 443 ssl;
server_name myblog.com;
location / {
proxy_pass http://wordpress/;
proxy_redirect http://wordpress/ https://myblog.com/;
proxy_set_header Host myblog.com;
proxy_set_header X-Forwarded-Proto https;
}
}
set directly $_SERVER['HTTPS']='on';
to the file wp-config.php
.
Upvotes: 0
Reputation: 1131
I solved my problem by editing wp-config.php:
$_SERVER['HTTPS']='on';
Upvotes: 5
Reputation: 518
Press CRTL + U and check your page source for HTTP, after you found where it's loading the HTTP replace it with HTTPS, usualy the problem is some image or logo not properly loaded / hard coded into HTTP.
Also why did you use $_SERVER['HTTP_HOST'] ? rather then just writing your domain. Possible problem that I see you don't need to use the backslash on last part of the domain.
define( 'WP_SITEURL', 'https://example.com' );
define( 'WP_HOME', 'https://example.com' );
And you don't need to use the other part's which you defined.
Upvotes: 0