GetSimple Support Forum

Full Version: get_theme_url() and https
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello forum members,

when I use get_theme_url()/someResource or something like that to include some resource into a page, the URL for the client always begins with http instead of https when the whole page is in https, resulting in mixed content errors in browsers.
I don't want to enforce https at all times, it should just work when a visitor to the site requests to use https.
phpinfo() shows that https mode is detected by php.

How can I fix this?
Hacked it, because no time to wait:

in theme_functions.php, I modded get_theme_url:

if ($_SERVER['https'])
{
$myVar = preg_replace('/^http:/','https:',$myVar);
}

Just in case if someone needs this as well or can be bothered to fix it in the repo...
get_theme_url should return $SITEURL which should be https if that is what you have set in settings.

If you are using https, then you should have https on your
Website URL: in settings, not sure what problem you are having since that usually works fine.
This is the same problem that i am having but i can't get the theme_functions mod to work.

The issue comes from having getsimple by default using http (i.e not wanting to force a secure connection to the server). However i have an ssl certificate installed and want its use to be optional. But if the site is browsed to via https the browser won't load anything over the insecure connection, i.e getsimple forces all of the get_theme_url links to http so css and js won't get loaded resulting in a very ugly broken page.

is anyone able to explain the mod too me a little more? php isn't my strong point so i'm not 100% sure what needs doing with it, I've located where the code would go (i think) but no matter where i put it it doesn't seem to work. the only other thing i can think of is having getsimple load it like "//" instead of "https://" or "http://" if you get my drift

any help that can be provided would be fantastic.

Regards

BMcG