LoginSignup
3
4

More than 5 years have passed since last update.

htaccessで、httpからhttpsへリダイレクトさせる

Posted at

ElB(ロードバランサー@AWS)環境で、httpからhttpsにリダイレクトをかける際は、htaccessファイルに以下を記述すると良い。X-Forwarded-Protoを気にしないと、無限ループが発生してしまう。
詳しくは、こちら

RewriteEngine On
# Force HTTPS
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R,L]
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4