non-www to www redirect problem with ssl

Discussion in 'Apache' started by Camay123, Jun 20, 2008.

  1. #1
    I have a site:

    mydomain.com for example

    I want to redirect mydomain.com to www.mydomain.com for all request. I am using this code:


    However, my SSL certificate is on mydomain.com

    My site is a zen-cart site, and when people logs in, it kicks in the SSL mode, which means using mydomain.com instead of www.mydomain.com.

    This is causing an error, because the site wants to use https://mydomain.com for SSL matters, while the .htaccess wants to convert to www.

    Any suggestions for the redirect using the code previously mentionned in .htaccess applys only when not in SSL ?
     
    Camay123, Jun 20, 2008 IP
  2. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #2
    Not 100% on this, but try:

    RewriteCond %{HTTPS} !=on
     
    zacharooni, Jun 20, 2008 IP
    Camay123 likes this.
  3. Camay123

    Camay123 Well-Known Member

    Messages:
    3,423
    Likes Received:
    86
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Like this:

    ??
     
    Camay123, Jun 20, 2008 IP
  4. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #4
    Yeah, give that a shot.
     
    zacharooni, Jun 20, 2008 IP
  5. Camay123

    Camay123 Well-Known Member

    Messages:
    3,423
    Likes Received:
    86
    Best Answers:
    0
    Trophy Points:
    160
    #5
    this as done the job. Thanks. I am adding you a rep point for this help.
     
    Camay123, Jun 20, 2008 IP
  6. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #6
    Sweet thanks :) Glad I could help!
     
    zacharooni, Jun 20, 2008 IP