Discussed HTTP to HTTPS rewrite rule for windows platform IIS on previous post. If the web server as linux based environment that can be archived and play with .htaccess file.
.htaccess file has always in hidden attribute so edit the file with vi editor
1 |
sudo vi .htaccess |
Add the below code of mod_rewrite.c module to make http to https redirection.
1 2 3 4 5 6 7 8 9 |
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^(www\.)?sathiya.io [NC] RewriteRule (.*) https://sathiya.io/$1 [L,R=301,QSA] #If ‘www’ is required then enable below rule instead of above one #RewriteRule (.*) https://www.sathiya.io/$1 [L,R=301,QSA] </IfModule> |
Cheers!
Suggestion: HTTP to HTTPS rewrite rule (IIS)