遅まきながら自分のウェブサイトをhttps対応しました。(Let's encryptで)
CentOS 7.x + Apache 2.4.x
です。
ウェブブラウザのアドレスバーに下記アドレスを打ち込むとhttpsにリダイレクトされます。
↓
www.my.example.com/
や
www.my.example.com/gadgets/
しかしながら
www.my.example.com/index.html
や
www.my.example.com/gadgets/my.cgi
の場合は、httpのままです。
Apache の RewireRule の書き方が間違っていると思うので、気づいた点を教えていただけないでしょうか。
なお、Apache のアクセスログは、上の4つとも「200」のステータスを返します。
httpd.confの関係ありそうなところを書きます。必要なところまで省略していたらごめんなさい。
httpd.conf
1<VirtualHost *:80> 2 DocumentRoot /home/my/www 3 ScriptAlias /cgi-bin/ "/home/my/www/cgi-bin/" 4 ServerName www.my.example.com 5 AddOutputFilter INCLUDES .html 6 <Directory "home/my/www"> 7 Options Includes ExecCGI FollowSymLinks 8 AllowOverride All 9 Require all granted 10 </Directory> 11 <Directory "home/my/www/cgi-bin"> 12 Options Includes ExecCGI 13 AddHandler cgi-script .cgi .pl .pm 14 AllowOverride None 15 Require all granted 16 </Directory> 17 18RewriteEngine on 19 20RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) 21RewriteRule .* - [F] 22 23RewriteCond %{SERVER_NAME} =www.my.example.com 24RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] 25RewriteRule ^/cgi-bin/(.*)$ https://%{SERVER_NAME}/cgi-bin/$1 [END,NE,R=permanent] 26 27</VirtualHost>
よろしくお願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。