blog
copyright ©
creamu Inc. All Rights Reserved.
art direction & design: Kunitaka Kawashimo
code, interaction & photography: creamu Inc.
category: Diary

http://のURLをSSL付きのhttps://に統一する方法

Pocket

http://のURLをSSL付きのhttps://に統一するには、.htaccessに以下のように書きます。

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

WordPressでは上記を.htaccessのデフォルトの以下記述の後に書くと、トップページ以外がリダイレクトできません。そのため、以下記述の前に、上記を記述します。?

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress