Can a domain redirect work for both http and https?
Nginx/settings.php


Try this: $base_url = 'https://'.$_SERVER['SERVER_NAME'];


Apache/.htaccess:


You can simply add the following to your .htaccess. It will redirect all traffic from http://example.com and http://www.example.com to https://example.com. Put that below RewriteEngine on. 

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www.example\.com*
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]