Rerouting all http traffic to https with AWS ELB

后端 未结 2 1033
忘掉有多难
忘掉有多难 2020-12-09 20:27

So I\'ve looked over the other similar questions and they offer solutions but none of them seem to work for some reason. So, for starters, my ELB is set up so that



        
相关标签:
2条回答
  • 2020-12-09 20:49

    To rewrite from http to https use following rules.
    Also check if your mod rewrite is enabled and working properly.

    RewriteEngine On
    # This will enable the Rewrite capabilities
    
    RewriteCond %{HTTPS} !=on
    # This checks to make sure the connection is not already HTTPS for "normal" conditions
    
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    # This checks the connection is not already HTTPS for AWS conditions
    
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    # This rule will redirect users from their original location, to the same location but using HTTPS.
    # i.e.  http://www.example.com/foo/ to https://www.example.com/foo/
    # The leading slash is made optional so that this will work either in httpd.conf
    # or .htaccess context
    
    0 讨论(0)
  • 2020-12-09 21:04

    It's just your RewriteRule which is not valid. Please see this post on how it should look.

    0 讨论(0)
提交回复
热议问题