mod_rewrite rule for HTTP to HTTPS

Discussion in 'Apache' started by mummana, Dec 22, 2008.

  1. #1
    Hi,

    I am using the below configurations to redirect from HTTP to HTTPS login page.
    It redirects http://test.com to https://test.com/home/login.jsp.

    But when I request as https://test.com/, it is not redirecting to the login page.

    ==========================================================
    RewriteCond %{HTTP_HOST} test.com [NC]
    RewriteCond %{HTTPS} !on
    RewriteRule .* https://test.com/home/login.jsp [R=301,L]

    ==========================================================
    Could you please help me regarding.

    Thanks
    Srini
     
    mummana, Dec 22, 2008 IP
  2. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Your rules are working 100%, you don't want to redirect to the login page automaticlly on the https domain with your htaccess rules, as even when you log in, you'd always get pushed to the login page, Your software should automaticlly redirect your users to the login page if they try to access restricted content.
     
    powerspike, Dec 22, 2008 IP