DEV Community

David Mutebi
David Mutebi

Posted on

The truth about SSL certificates.

What is an SSL certificate?
SSL certificates are what enable websites to move from HTTP to HTTPS which is more secure.
SSL — more commonly called TLS is a protocol for encrypting internet traffic and verifying server identity.

Why does your website need an SSL certificate?
During login, SSL secures the username and password.
You also need SSL to stop your customer’s data from being appropriated by hackers if you running an e-commerce website.

How to add an SSL certificate to your site through the .htaccess file
add the following:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

To redirect only to a specific domain
For redirecting a specific domain to use HTTPS, add the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

Top comments (0)