How to get HTTPS: Setting up SSL on your website

If you are collecting ANY sensitive information on your website (including email and password), then you need to be secure. One of the best ways to do that is to enable HTTPS, also known as SSL (secure socket layers), so that any information going to and from your server is automatically encrypted. The prevents hackers from sniffing out your visitors’ sensitive information as it passes through the internet.

secure lock https

Your visitors will feel safer on your site when they see the lock while access your website – knowing it’s protected by a security certificate.


The best thing about SSL is it’s simple to set up, and once it’s done all you have to do is route people to use HTTPS instead of HTTP. If you try to access your site by putting https:// in front of your URLs right now, you’ll get an error. That’s because you haven’t installed an SSL Certificate. But don’t worry – we’ll walk you through setting on up right now!

Setting up HTTPS on your website is very easy, just follow these 5 simple steps:

  1. Host with a dedicated IP address
  2. Buy a certificate
  3. Activate the certificate
  4. Install the certificate
  5. Update your site to use HTTPS

Step 1: Host with a dedicated IP address

In order to provide the best security, SSL certificates require your website to have its own dedicated IP address. Lots of smaller web hosting plans put you on a shared IP where multiple other websites are using the same location. With a dedicated IP, you ensure that the traffic going to that IP address is only going to your website and no one else’s.

An affordable host I recommend for a dedicated IP is StableHost. At this time it’s under $6/month, but you can get it cheaper if you order for a full year. They’re my host and I’ve been blown away with their support and performance. Oh, and here’s a coupon for 40% off: expert40

If you don’t have a plan with a dedicated IP  you can ask your current web host to upgrade your account to have a dedicated IP address. There will probably be a charge for it – it could be one-time or monthly fees.

Step 2: Buy a Certificate

Next you’ll need something that proves your website is your website – kind of like an ID Card for your site. This is accomplished by creating an SSL certificate. A certificate is simply a paragraph of letters and numbers that only your site knows, like a really long password. When people visit your site via HTTPS that password is checked, and if it matches, it automatically verifies that your website is who you say it is – and it encrypts everything flowing to and from it.

Technically this is something you can create yourself (called a ‘self-signed cert’), but all popular browsers check with “Certificate Authorities” (CA’s) which also have a copy of that long password and can vouch for you. In order to be recognized by these authorities, you must purchase a certificate through them.

NameCheap is where I buy my certificates. They have a few options, but the one that I find best is the GeoTrust QuickSSL.  At this time it’s $46 per year, and it comes with a site seal that you can place on your pages to show you’re secure – which is good for getting your customers to trust you. You’ll simply buy it now, and then set it up by activating and installing it in the next steps.

Step 3: Activate the certificate

Note: Your web host may do this step for you – check with them before proceeding. This can get complicated and if you can wait 1-2 days it may be best to let them do it.

If you’re activating the certificate yourself, the next step is to generate a CSR. It’s easiest to do this within your web hosting control panel – such as WHM or cPanel. Go to the SSL/TLS admin area and choose to “Generate an SSL certificate and Signing Request”. Fill out the fields in the screen below:

generate a CSR

“Host to make cert for” is your domain name, and the contact email can be blank. When you’ve filled it out, you’ll see a screen like this:

Generated CSR

Copy the first block of text. You’ll need this “CSR” to give to the SSL cert issuer so they can establish your identity. Login to your NameCheap account (or wherever you bought your certificate) and activate it. Paste your CSR and any other fields needed. It will ask you for an approver email. This is an email address that proves you own the domain, ie If it doesn’t exist, you’ll need to create it so you can get the email that contains the final certificate. Follow the steps and when you are done that email address should have received the cert as a .crt file.

Step 4: Install the certificate

Note: Your web host may also do this step for you too – check with them before proceeding. This can get complicated and if you can wait 1-2 days it may be best to let them do it.

If you’re installing up the certificate yourself, this is the easiest step you’ll ever do. You have the certificate in hand, all you need to do is paste it into your web host control panel. If you’re using WHM.CPanel, click the “Install an SSL Certificate” from under the SSL/TLS menu.

Installing a cert

Paste it into the first box and hit submit. That’s it! Now try to access your site via – you should be secure!

Step 5: Update your site to use HTTPS

At this point if you go to you should see it load! Congrats, you’ve successfully installed SSL and enabled the HTTPS protocol! But your visitors aren’t protected just yet, you need to make sure they’re accessing your site through HTTPS!

Keep in mind that you typically only need to protect a few pages, such as your login or cart checkout. If you enable HTTPS on pages where the user isn’t submitting sensitive data on there, it’s just wasting encryption processing and slowing down the experience. Identify the target pages and perform one of the two methods below.

You can update all links to the target pages to use the HTTPS links. In other words, if there’s a link to your cart on your home page, update that link to use the secure link. Do this for all links on all pages pointing to the sensitive URLs.

However, if you want to ensure that people can only use specific pages securely no matter what links they come from, it’s best to use a server-side approach to redirect the user if it’s not HTTPS. You can do that with a code snippet inserted on top of your secure page. Here’s one in PHP:

// Require https
if ($_SERVER['HTTPS'] != "on") {
    $url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    header("Location: $url");

Another server-side approach is to use mod-rewrite. This won’t require you to change any of your website files, but will need you to modify your apache configuration. Here’s a nice mod-rewrite cheat sheet , or just use this example:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(cart/|checkout/) https://%{HTTP_HOST}%{REQUEST_URI}

This will ensure that if anyone accesses a page via HTTP they will automatically be redirected to HTTPS.


  • Understand that HTTPS doesn’t mean information on your server is secure, it only protects the TRANSFER of data from your visitor’s computer to yours, and the other way too. Once the sensitive data is on your server it’s up to you to keep that data safe (encrypt in database, etc).
  • Some people just look for a lock on the page, not on the browser. After you’ve installed SSL you might want to try adding a lock icon on your pages just to let them know it’s secure if they don’t look in the url bar.


What makes a website secure? A properly installed security certificate.

Congratulations! You’ve successfully protected your website by installing an SSL cert and made your visitors less prone to attacks. You can breathe easy knowing that any information they submit on your website will be encrypted and safer from packet sniffing hackers.

Resources Used

Posted in Web Servers
18 comments on “How to get HTTPS: Setting up SSL on your website
  1. Junaid Ahmed says:

    wow ! worked for me (:

  2. mark says:

    Thanks for the tips, also might want to also check out, they have a pretty robust knowledge base and a couple SSL tools that come in handy.

  3. Rajan says:

    I don’t have any transaction to be made on my site so should I get SSL certificate or not

    • SSL certs are needed if you collect any sensitive information – usually credit cards and security numbers. But these days it’s recommended even for email addresses

  4. God of The internet says:

    A SSL cert means nothing these days. Its a false sense of security. Anything you do online is open to public attacks and eyes. This includes bank logins and transactions. The SSL cert is just a way for these companies to grab your money.As a security expert, I can tell you this from first hand. I can sit anywhere in a public place where people use their wireless device and steal any info they send across the airwaves including bluetooth.

    • jules says:

      This appears to be the internet equivalent of saying ‘we are all going to die’….yes but in the mean time we all have to live, so comments like this are extremely unhelpful with out giving a solution, so thanks for increasing the sense of vulnerability and may be you can give your solution? If SSL is useless then what do you suggest?

  5. Jake Glyndal says:

    “What makes a website secure? A properly installed security certificate.” Uh, no. No no no no. All it does is put up a fence around the data being communicated between the visitor and the website. It doesn’t “secure” the website from attackers.

  6. Prashant says:

    Great article Shane…it helped me :) Thank you for sharing

  7. Thank you for everything details i think am one step ahead of getting my website secure.

  8. Archana says:

    The article helps

    Thanks heaps Shane!!

  9. Chandan says:

    Hi Shane,
    Can the redirection be done through .htaccess?

  10. joe says:

    hello, im new to web designing…my question: where in my site do i put this php code

    “// Require https
    if ($_SERVER[‘HTTPS’] != “on”) {
    $url = “https://”. $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’];
    header(“Location: $url”);

    is it in the “head” section or the “body” section

  11. Mitch says:

    I read the article and realized that this is two years ago but still the information is relevant. I agree! Installing SSL on the site will secure private data sent over the Internet. Google loves secured site as well. Thanks for the tip!

    By the way, what do you think with They provide a wide range of digital certificates to fit any needs at a lower price.

  12. LS says:

    Thanks mate!
    Been looking for somewhere to tell me the 1 2 3 of SSL and this is exactly what I wanted 😀

Leave a Reply

Your email address will not be published. Required fields are marked *