How to Redirect http to https | SSL Problem

How to Redirect http to https | SSL Problem

Hello today I will be show you How to Redirect HTTP to https so You have first need to make a .htaccess file then you go to file manager > click setting > and mark Show Hidden files because .htaccess file is a hidden file

ssl

ok now copy the code and pest .htaccess file and save your .htaccess file

if you need https://  use the code

# 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>

or if you need https://www.  use the code

# 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>

Thanks if you feel any problem just comment


Leave a Reply

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