Apache and SSL, basic question

I am building a website using PHP and its going to live on an Apache server. There are certain parts of the site that are just content, they don't need to be secure but there are a few pages like the login and settings pages that I'd like to be secure. I've heard about SSL and I was wondering. How does it work? Do I need to add special code to my PHP code or is it something that I just do on the server.

For example, say my source file is login.php, how do I just tell Apache to use SSL on that? Sorry if this is a pretty basic and newbie question but I am lost when it comes to this sort of stuff.
LVL 2
LinkyAsked:
Who is Participating?
 
periwinkleConnect With a Mentor Commented:
Assuming that you have SSL set up on your server, with a certificate, etc., to access via SSL is simply a matter of changing the url from:

http://www.yourdomain.com/login.php

to

https://www.yourdomain.com/login.php

(i.e. from http:// protocol to https:// protocol).
0
 
LinkyAuthor Commented:
then what is stopping people from just typing http instead of https
0
 
periwinkleCommented:
Nothing, unless you code preventatively!
0
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

 
LinkyAuthor Commented:
And how can that be done, so that even if they type http://whatever it will use SSL anyway. I'm using PHP but I doubt that matters since this is mainly dealing with the server.
0
 
periwinkleCommented:
It won't - unless you redirect the http:// request to a https:// request.  But from what you have said, you're only having a few pages that are ssl - if you LINK to them as https:// then they'll be secure!
0
 
LinkyAuthor Commented:
Sounds good, thanks for the help.
0
All Courses

From novice to tech pro — start learning today.