So you just secured your website with an SSL Certificate and you want to ensure your site can only be accessed through https. If that is the case then you are in the right place.

If you have not secured your website then I believe you need to pause and ensure you secure your site before coming back here. The benefits of having your site secured cannot be over-emphasized. You can even secure your site for free.
Back to the topic at hand, there are many ways you can go about this redirection process. Below is a list of some of the ways you can go about this. You can go through the list and pick which works for you.

1. C-PANEL: Login to your C-Panel and go to the File Manager. In the public_html folder search for the file named .htaccess . If you cannot find this file then it means it is in the hidden files. Click on Settings and enable ‘Show Hidden Files’. Now you should be able to see the .htaccess file. Open this file and go to the end of the file where you will need to put the following lines of code:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Save the file and try accessing the website through http:// to see if it will redirect to https:// automatically.

2. APACHE: Login to your Apache server and search for the conf folder. In the conf folder, look for the http.conf file. We will need to open this file to make some adjustments, but make sure you Backup the file before any adjustments. Now that you are inside the http.conf file, search for the line where you have:

LoadModule rewrite_module modules/mod_rewrite.so

When you find this line, add the following lines of code under it:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Save the file and Restart your Apache Server.

That’s all. You can test if this worked by trying to access your website through http://. It should redirect the site to https://

3. CLOUDFLARE: this is one of the best means to secure your website. If you already used this method to get a SSL Cerificate, then just login to Cloudflare and choose your website. Then choose the SSL/TLS section and click on Edge Certificates.

Now make sure you turn on the ‘Always Use HTTPS’ as shown below.

That should do it. Now test your site to see if it worked.

4. WORDPRESS: If your website is powered by WordPress then just install and activate the ‘SSL Insecure Content Fixer Plugin’. This plugin will ensure your site is accessed through https:// .

We hope this was helpful to you in making sure your website is now passed through https alone.

Leave a Reply