wordpressを常時SSL化する
googleのhttps優遇政策が発表されてからもうすぐ1年。やっとwordpressを常時SSL化したのでその手順を。
.htaccessファイルでリダイレクト設定
.htaccessファイルはwordpressのコンテンツをおいている同階層にある.htaccessファイルを編集してください。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
cd /your/docment/root #.htaccessファイルの編集 #追加する場所は# BEGIN WordPressの前です vim .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] </IfModule> # 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> #httpdの再起動 systemctl restart httpd.service |
以上で常時SSL化の作業が完了です。