httpsでしか接続できないようにする方法
Modified: 1 January 2005, 15 September 2002
特定のフォルダ内のページを、HTTPによる閲覧を拒否し、HTTPSでのみ閲覧を許す方法を紹介します。
".htaccess"を作る
"https"でのみアクセスを許す場合、そのフォルダに以下の ".htaccess" を作成します。
RequireSSL on
FedoraCore3で動作確認したところ、上記設定では動作しませんでしたが、以下の指定で成功しました。
SSLRequireSSL
"/etc/httpd/conf/httpd.conf"を変更する
".htaccess" の設定を有効にするために、"/etc/httpd/conf/httpd.conf"を変更します。
変更前の以下の記述を探します。
:
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None
:以下のように、"AllowOverride"を変更します。つまり、"None" を、"AuthConfig" に変更します。
:
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
# AllowOverride None
AllowOverride AuthConfig
:
Apacheを再起動する
変更を有効にするために、Apacheを再起動します。