Andy
A-ndy.dev

A-ndy.dev

Redirect non-www to www and http to https .htaccess

Andy's photo
Andy
·Aug 5, 2018·

1 min read

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\\. \[NC\]
RewriteRule ^(.\*)$ http://www.%{HTTP_HOST}/$1 \[R=301,L\]

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