There are a lots of example in the net which suggest to force HTTPS. E.g:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
I have nowhere found any example which uses a 301 Moved Permanentlyredirect. Why not?
Wouldn’t this avoid further requests to the HTTP site? And Google search results pointing to the HTTP site?
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
Why is this used by nobody? Or did I just overlooked somebody who uses it?
The
[R]flag will force an external redirect, the default status being 302 (temporarily relocated). AFAIK, you can set it to 301 by using[R=302,L]I do not know why you wouldn’t use 301 instead of 302 in this context.