Rerouting all http traffic to https with AWS ELB Rerouting all http traffic to https with AWS ELB apache apache

Rerouting all http traffic to https with AWS ELB


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 capabilitiesRewriteCond %{HTTPS} !=on# This checks to make sure the connection is not already HTTPS for "normal" conditionsRewriteCond %{HTTP:X-Forwarded-Proto} !https# This checks the connection is not already HTTPS for AWS conditionsRewriteRule ^/?(.*) 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


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