一般サイトでも常時SSL化の流れですね。
大雑把なSSL化の際の.htaccessの書き方です。
以下、詳細です。
サイト全体をhttpsへ301リダイレクト
1 2 3 4 |
RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |
基本はこのあたりでしょうか。
サイト全体をhttpへ301リダイレクト
1 2 3 4 |
RewriteEngine on RewriteCond %{HTTPS} on RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |
逆にhttpへリダイレクトする場合です。
あまりなさそうです。
サイト全体をhttpsへ301リダイレクトしてwwwありに
1 2 3 4 5 6 7 |
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTP_HOST} ^u-618\.org RewriteRule ^(.*) https://www.u-618.org/$1 [R=301,L] |
サイト全体をhttpsへ301リダイレクトしてwwwなしに
1 2 3 4 5 6 7 |
RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTP_HOST} ^www\.u-618\.org RewriteRule ^(.*)$ https://u-618.org/$1 [R=301,L] |
U-618WEBはwwwなしですね。
以上です。
ご参考まで。