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

Posted on

We all know HTTPS must be all over the place, and recently, Google has thought-about this as a rating sign to their search engine outcomes. We extremely suggest that you just require all guests to your website to entry it via a safe connection.

UnivaHost Internet hosting features a free SSL Certificates for all Shared, E-Commerce and Enterprise Internet hosting. It’ll routinely set up in your cPanel or Plesk Management Panel.

Forcing HTTP to HTTPS with .htaccess

I assume you’re utilizing this on a shared internet hosting platform cPanel or Plesk Management panel. First, it is advisable make sure the internet hosting supplier supply SSL and enabled in your area.

You will discover the .htaccess code in your cPanel > Public_html Folder and Plesk Management panel > Httpdocs Listing. If you don’t discover any .htaccess file simply create a .htaccess file. To drive all internet site visitors to make use of HTTPS, insert the next strains of code within the .htaccess file.

SSL Https energetic Pressure 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 Lively Pressure www in a Generic Method

<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 directions allow you to.

Examine Others Useful Article

offshore vps