redirect http to https with www

Discussion in 'Apache' started by martinvidic, Aug 20, 2010.

  1. #1
    Hi

    I'm currently doing this to redirect from non-www to www.
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www\.breslov\.org$
    RewriteRule ^(.*) http://www.breslov.org/$1 [R=301,L]

    But now I would also like to have https in the rule.

    so that
    http://domain.com$
    http://www.domain.com$
    https://domain.com$

    turn into
    https://www.domain.com$

    Does anybody know how to do that?
    Thanx
    M.
     
    martinvidic, Aug 20, 2010 IP
  2. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #2
    
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www\.breslov\.org$ [OR]
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*) https://www.breslov.org/$1 [R=301,L]
    
    Code (markup):
     
    tolra, Aug 20, 2010 IP