Hi All,
I want restrict to allow only https. So, I am trying to add condition by checking slim.url_scheme. But slim.url_scheme always showing http even I accessed from https. Can you please help what i need to modify.
Thanks
Hi All,
I want restrict to allow only https. So, I am trying to add condition by checking slim.url_scheme. But slim.url_scheme always showing http even I accessed from https. Can you please help what i need to modify.
Thanks
I donât know if there is a way to force https via Slim (newbie), but if you have access to the server, specifically httpd.conf or vhosts (in Apache), you can use: Redirect permanent / https://urlGoesHere in the <VirtualHost *:80> section. Else, I would use PHP code to redirect:
if ($_SERVER[âSERVER_PORTâ] != 443) {
$redir = âLocation: https://â . $_SERVER[âHTTP_HOSTâ] . $_SERVER[âPHP_SELFâ];
header($redir);
exit();
}
From request you can pick up connection protocol like this
$request->getUri()->getScheme()
This works very well.