Using PHP with SSL

Hi all, just trying to work out how I can make a page only viewable through SSL, otherwise a redirect to the homepage will be made.

I’m also not sure how to use SSL, is it as simple as just changing the link to https://? I don’t use absolutely URLs, I use a href=“/about/” so how would I get around this?

Apologies for all the questions, never had to use SSL. Any helps is appreciated as always :slight_smile:

I think you’d be better off making all these redirections at web-server level. If you use apache, then here are examples on how to do that:
htaccess HTTPS / SSL Tips, Tricks, and Hacks

If you do not like that option, then in PHP: $_SERVER[‘HTTPS’] will be set to a non empty value if script is accessed via https://

Hey dude, thanks for the reply, brilliant the link is a lot of help.

So is it as simple as just linking to a URL with https//? I don’t use absolute URL’s so is this something I will need to do?

if you don’t use abolute urls, then everything will happen automatically. Check twice all paths to css/javascript files and to resources inside them. Also external javascripts/content must be seved over SSL or else you will get SSL mixed content warning and broken padlock in URL.