Ssl Issue Fix Http To Https

Apr 26, 2021 SSL Certificate

How to Fix SSL issue http to https redirect using .htaccess

Reading Time: < 1 minute

We know HTTPS should be everywhere, and lately, Google has considered this as a ranking signal to their search engine results. We highly recommend that you require all visitors to your site to access it through a secure connection.

UnivaHost Hosting includes a free SSL Certificate for all Shared, E-Commerce and Business Hosting. It’ll automatically install on your cPanel or Plesk Control Panel.

Forcing HTTP to HTTPS with .htaccess

I assume you are using this on a shared hosting platform cPanel or Plesk Control panel. First, you need to ensure the hosting provider offer SSL and enabled for your domain.

You will find the .htaccess code on your cPanel > Public_html Folder and Plesk Control panel > Httpdocs Directory. If you do not find any .htaccess file just create a .htaccess file. To force all web traffic to use HTTPS, insert the following lines of code in the .htaccess file.

SSL Https active Force non-www

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
   RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
   RewriteCond %{HTTPS} !=on
   RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

SSL Https Active Force www in a Generic Way

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteCond %{HTTP_HOST} !^$
   RewriteCond %{HTTP_HOST} !^www\. [NC]
   RewriteCond %{HTTPS}s ^on(s)|
   RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

I hope the above instructions help you.

Check Others Helpful Article

SHARE NOW

Leave a Reply

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