Redirect traffic to https
Posted
by
Arpanet
on Server Fault
See other posts from Server Fault
or by Arpanet
Published on 2011-09-26T21:17:54Z
Indexed on
2011/11/12
9:56 UTC
Read the original article
Hit count: 129
apache2
I need to redirect the following instances to https://www.mydomain.com;
- mydomain.com
- www.mydomain.com
- http://www.mydomain.com
I have the following in my .htaccess already, but this only redirects mydomain.com to https://www.mydomain.com;
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
Grateful if anyone could perhaps tell me what I need to add. Thank you.
© Server Fault or respective owner