Redirect to https and www with one 301 redirect Redirect to https and www with one 301 redirect apache apache

Redirect to https and www with one 301 redirect


To redirect to https://www in a single request, you can use :

RewriteEngine onRewriteCond %{HTTP_HOST} !^www\. [OR]RewriteCond %{HTTPS} offRewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://www.%1%{REQUEST_URI} [NE,L,R=301]