In Apache .htaccess file using mod_rewrite, is it possible to force www AND force https for a domain?
RewriteCond %{HTTP_HOST} !^www.example.co.uk$ [NC]
RewriteRule ^(.*)$ https://www.example.co.uk/$1 [R开发者_如何学JAVA=301,QSA,L]
thats for the www, but I cannot figure out in a one-pass way how to force the https too?
Use the SERVER_PROTOCOL variable:
RewriteCond ${SERVER_PROTOCOL} !^https [NC]
精彩评论