[support] https and htaccess

Fahri Reza dozymoe at gmail.com
Fri Jul 22 23:11:42 UTC 2011


> > On Jul 22, 2011, at 8:10 AM, Lynn Stott (Stott Design) wrote:
> > Can some help with .htaccess? 
> > 
> > How do you redirect all 
> > https://www.site.com 
> > http://www.site.com 
> > http://site.com
> > 
> > to
> > 
> > https://site.com
> > 
> > 
> On Fri, 2011-07-22 at 08:24 -0600, Lynn Stott wrote:
> I think I got it. Both statements are necessary, I think... any
> comment?
> 
> 
>    RewriteCond %{SERVER_PORT} 80
>    RewriteRule ^(.*)$ https://mysite.com/$1 [R,L]
> 
> 
>    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
>    RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]


http://wiki.apache.org/httpd/RewriteHTTPToHTTPS
in your .htaccess with mod_rewrite

or

http://wiki.apache.org/httpd/RedirectSSL
in your virtual-host-conf with mod_alias(??)

the latest is the recommended one.


actually it's more like RewriteRule ^/?(.*)$ https://mysite.com/$1 [R,L]

with this note about "/?"--that i added--as seen in the first link:
  # The leading slash is made optional so that this will work either
  # in httpd.conf or .htaccess context

fireh.




More information about the support mailing list