I\'m looking for an .htaccess configuration that will redirect all requests to my site to https://www
.
So whether the user visits:
www.examp
Your regular expression ^example\.com
doesn't match www.example.com
. You probably want something like (^|\.)example\.com
or (^|\.)example\.com($|:)
.
Edit:
To prevent the redirect loop add
RewriteCond %{HTTPS} off
Before the RewriteRule.
Also see http://wiki.apache.org/httpd/RewriteHTTPToHTTPS (they use !=on
instead of off
) and http://wiki.apache.org/httpd/RedirectSSL