Redirecting entire site over HTTPS

Discussion in 'Apache' started by mummana, Feb 26, 2009.

  1. #1
    mummana, Feb 26, 2009 IP
  2. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #2
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^support\.tolranet\.com [NC,OR]
    RewriteCond %{SERVER_PORT} 80
    RewriteRule (.*) https://support.tolranet.com/$1 [R=301,L]
    Code (markup):
    That's what we use for our support site, you'll need to change the domain to be yours obviously.
     
    tolra, Feb 26, 2009 IP
  3. mummana

    mummana Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi Tolra, thanks for the quick reply.

    It works fine, when we request with http port ( server_prot will be 80).
    Issue is when we request using https://mysite.com,it is not redirecting to the https://mysite.com/home/login.jsp
    (server_port will be 443)

    Could you please help me for the issue..
     
    mummana, Feb 26, 2009 IP
  4. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #4
    Sorry, I got called away when answering you, note to self start from scratch when you get back.

    Try the following, it should redirect on an empty request as well:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.mysite\.com [NC,OR]
    RewriteCond %{SERVER_PORT} 80 [OR]
    RewriteCond %{REQUEST_URI} ^/$
    RewriteRule (.*) https://www.mysite.com/home/login.jsp [R=301,L]
    
    Code (markup):
     
    tolra, Feb 27, 2009 IP
  5. mummana

    mummana Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi Tolra, thanks for the help. The issue is solved.
     
    mummana, Feb 28, 2009 IP