htaccessによる、wwwあり/なし、httpからhttpsへのリダイレクト、スマホの場合にスマホページへのリダイレクト、を行っています。
SSL証明書はwww有りドメインの方で取得しており、wwwなしドメインでは取得していません。
そして、下記のパターンでスマホからアクセスした場合のみ、ブラウザに警告が出てしまいます。
PCではなぜか問題なくリダイレクト出ております。
https://example.com → https://www.example.com/sp
その他、下記のパターンはうまくリダイレクトします。
https://www.example.com → https://www.example.com/sp
http://www.example.com → https://www.example.com/sp
http://example.com → https://www.example.com/sp
htaccessの記述は下記の通りです。
htaccess
1 RewriteEngine On 2 RewriteCond %{HTTP_USER_AGENT} (iPhone|Android.*Mobile|Windows.*Phone) [NC] 3 RewriteCond %{QUERY_STRING} !mode=pc 4 RewriteRule ^$ /sp/ [R,L] 5 6 RewriteCond %{HTTP_HOST} ^example.com 7 RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] 8 9 RewriteCond %{THE_REQUEST} ^.*/index.html 10 RewriteRule ^(.*)index.html$ /$1 [R=301,L] 11 12 RewriteCond %{THE_REQUEST} ^.*/index.php 13 RewriteRule ^(.*)index.php$ /$1 [R=301,L] 14 15 RewriteCond %{REQUEST_FILENAME} !-d 16 RewriteCond %{REQUEST_URI} !^/blog.*$ 17 RewriteRule ^(.*)/$ /$1 [L,R=301] 18 19 RewriteCond %{REQUEST_URI} !^/blog.*$ 20 RewriteCond %{REQUEST_FILENAME} !-d 21 RewriteCond %{REQUEST_FILENAME} !-f 22 RewriteRule ^ index.php [L]
https://example.com から https://www.example.com/sp へのリダイレクトでブラウザの警告が出ない方法はありますでしょうか。
なお、htaccessではなくapacheのconfigで対応が出来るのであればそちらでも大丈夫です。
どうぞよろしくお願いします。
【追記】
ブラウザの警告画面を添付します。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。