1RewriteEngine On
2RewriteBase /
3RewriteCond %{HTTPS} !=on
4RewriteCond %{HTTP_HOST} ^yourdomain\.com [OR]
5RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com
6RewriteRule .* https://yourdomain.com%{REQUEST_URI} [R=301,L]
1<IfModule mod_rewrite.c>
2 RewriteEngine On
3 RewriteCond %{HTTPS} off
4 RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
5</IfModule>
1#htaccess
2
3RewriteEngine On
4RewriteCond %{HTTPS} !=on
5RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
1RewriteEngine On
2RewriteCond %{HTTPS} on
3RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
1<IfModule mod_rewrite.c>
2....
3....
4# Redirect To HTTPS
5RewriteCond %{HTTPS} off [OR]
6RewriteCond %{HTTP_HOST} ^www\. [NC]
7RewriteRule ^ https://example.com%{REQUEST_URI} [L,NE,R=301]
8...
9...
10</IfModule>
1RewriteEngine On
2RewriteCond %{SERVER_PORT} 80
3RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]