mod_rewrite rule to home page with HTTPS

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

  1. #1
    Hi,
    I want to redirect from HTTP to HTTPS login page .

    It works correclty, when I request with http://test.com, it redirects http://test.com/home/login.jsp

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

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

    Could you please help me regarding.

    Thanks
    Srini
     
    mummana, Dec 17, 2008 IP
  2. caribbean_hatch

    caribbean_hatch Peon

    Messages:
    19
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It could have to do with where these conditions are located in your config file. If they're withing a directive that's only applying to port 80 and not 443, they'll be ignored for incoming ssl requests.

    Also, if all you're concerned about is making sure the login access info is secure, this is fine. But if you also want the pages behind the login page to be secure, you should use a header include file and sessions to check the authentication state for each page.
     
    caribbean_hatch, Dec 19, 2008 IP