I'm doing a little PHP code that interfaces with B4X
I need to figure out if the requested page is SSL, i.e. if the address starts with https. This is because in case I want to redirect to the secure page.
I have tried many sources found on the web but none have worked.
(Should probably have been posted in Chit Chat or something like that.)
Your question is a bit strange. Usually this is something that is handled by the webserver. Like my site, for instance. It answers at http://www.example.com/what/ever/here but instantly redirects the browser to https://www.example.com/what/ever/here. So, in effect, my code never gets a request over http, only over https.
(Should probably have been posted in Chit Chat or something like that.)
Your question is a bit strange. Usually this is something that is handled by the webserver. Like my site, for instance. It answers at http://www.example.com/what/ever/here but instantly redirects the browser to https://www.example.com/what/ever/here. So, in effect, my code never gets a request over http, only over https.
Well, that's a poor hosting server solution you got going there. If it's an option I'd upgrade it to something that's above hobby level. But in case that's not possible, here's the first hit I got when I searched for php check if request over https
I've seen many tutorials online that says you need to check $_SERVER['HTTPS'] if the server is connection is secured with HTTPS. My problem is that on some of the servers I use, $_SERVER['HTTPS'] i...
stackoverflow.com
The first answer seems fine to me, would that work for you?
I just want to add one aspect: Considering how very limited the hosting provider keep their servers, even if @Star-Dust would find a working solution (like the one posted by @LucaMs above) would work - it's no guarantee it will work the day after. Just sayin’ - it might be risky to depend on them if this is something that people actually will be using.
I have seen that it is indeed a server problem, I have found other complaints.
Joomla must be activated and from there set a force for all addresses such as https.
I currently use altervista for testing. Offers free php, ftp, database, backup etc ...
However at this point it is not important as it is only for testing the App. Then with the final server I suppose the php code should work or better the server will set everything to https