Dondariadmin (トーク | 投稿記録) (ページの作成:「 == .htaccess == RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]」) |
Dondariadmin (トーク | 投稿記録) |
||
2行目: | 2行目: | ||
== .htaccess == | == .htaccess == | ||
− | + | <pre> | |
− | + | RewriteEngine on | |
− | + | RewriteCond %{HTTPS} off | |
+ | RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] | ||
+ | </pre> | ||
+ | |||
+ | * RewriteRuleのR(redirect)はコード省略時は302(一時的な転送:Temporary Redirect)となる | ||
+ | * この記述をすると常にリダイレクトするので、ケースとしては移転が近いと思われる。 | ||
+ | * コード301(恒久的な転送:Permanent Redirect)を指定する場合は下記。 | ||
+ | |||
+ | <pre> | ||
+ | RewriteEngine on | ||
+ | RewriteCond %{HTTPS} off | ||
+ | RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | ||
+ | </pre> |
RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]Tweet