WordPress how to force https ssl

21. jūlijs, 2021

If your WordPress site lives behinde https terminator, then even if user open WordPress throug https, WordPress will work as if it where open with http

To avoid this you can put these lines in your wp-config.php to set globaly that server request is coming throug https

JavaScript
$_SERVER['REQUEST_SCHEME'] = 'https';
$_SERVER['HTTPS'] = 'on';

By default WordPress checks if page is open through https and generates every link with https protocol

This is very usefull because modern browsers practices wont load http requests if page is requested over https

Either way it is recomended to always use ssl cert