さくらのVPSを使用してますが、初期設定は知人にしていただいたので、恥ずかしながらapacheの知識は殆どなくググって調べてコピペしているレベルです。
htaccessの設定でhttpsにリダイレクト301をかけたく、うまくいきません。
(画面が真っ白、Chromeではxxxxx.comでリダイレクトが繰り返し行われました。と表示されます)
下記、リダイレクトが上手くいってるかどうかチェックしてくれるツールでURLをたたくと
http://tools.seochat.com/tools/header-checker-tool/
下記、xxxxxは任意ドメインになります。
結果:
http://www.xxxxx.com - 301恒久的な移動
https://www.xxxxx.com/ - 見つかった302
http://www.xxxxx.com/ - 301恒久的な移動
https://www.xxxxx.com/ - 見つかった302
何が原因かわかりますでしょうか。
ちなみに、SSL認証はさくらインターネットのSSLプランでのrapid.sslとは違うものです。(これは特に関係ないかと。。)
ほぼ、#コメントアウトですが、元々設定されてあった(前の担当者)部分を1個1個#で消していって原因をさぐっています。#の部分は一度試しています。どなたかご教示お願いできますでしょうか。よろしくお願いいたします。
Options +FollowSymLinks +ExecCGI #<IfModule mod_rewrite.c> RewriteEngine On # uncomment the following line, if you are having trouble # getting no_script_name to work #RewriteBase / #20170118 DirectoryIndex index.php index.html index.cgi #RewriteCond %{HTTP_HOST} ^http://xxxxx\.com #RewriteRule ^(.*) http://www.xxxxx.com/$1 RewriteCond %{HTTPS} off RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] #RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] #RewriteRule ^(.*)$ https://www.xxxxx.com/$1 [R=301,L] # we skip all files with .something # comment the following 3 lines to allow periods in routes #RewriteCond %{REQUEST_URI} \..+$ #RewriteCond %{REQUEST_URI} !\.html$ #RewriteRule .* - [L] # we check if the .html version is here (caching) #RewriteRule ^$ index.html [QSA] #RewriteRule ^([^.]+)$ $1.html [QSA] #RewriteCond %{REQUEST_FILENAME} !-f # no, so we redirect to our front web controller #RewriteRule ^(.*)$ index.php [QSA,L] #</IfModule> # big crash from our front web controller ErrorDocument 500 "<h2>Application error</h2>symfony application failed to start properly"
回答2件
あなたの回答
tips
プレビュー