Friday 23 February 2018

How to redirect on http to https and www to no www

1.) Redirect http to https :-

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

2.) Redirect wwwto no www :-

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [L,R=301]

No comments:

Post a Comment