質問編集履歴

1

自分なりにSSL統一のコードを書いてみました。

2017/11/05 04:39

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -28,21 +28,37 @@
28
28
 
29
29
 
30
30
 
31
+ ###追記
32
+
33
+ 自分なりにSSL統一のコードを書いてみましたが
34
+
35
+ 一向にhttp→httpsにリダイレクトする様子がありません。
36
+
37
+
38
+
39
+ いじったのは先頭の"# SAKURS SSL WordPress"と"# http to https"の部分です。
40
+
41
+ どこが間違っているのか教えて頂けると幸いです。
42
+
43
+
44
+
31
45
  ###.htaccess
32
46
 
33
47
 
34
48
 
35
49
  ```
36
50
 
37
- # SAKURS SSL
51
+ # SAKURS SSL WordPress
38
52
 
39
53
  <IfModule mod_rewrite.c>
40
54
 
41
- RewriteEngine on
55
+ RewriteEngine On
42
56
 
43
- RewriteCond %{HTTPS} off
57
+ RewriteBase /
44
58
 
59
+ RewriteCond %{REQUEST_URI} !^/wordpress/wp-cron.php$
60
+
45
- RewriteCond %{HTTP:X-SAKURA-FORWARDED-FOR} ^$
61
+ RewriteCond %{HTTP:X-Sakura-Forwarded-For} ^$
46
62
 
47
63
  RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
48
64
 
@@ -92,6 +108,18 @@
92
108
 
93
109
  RewriteBase /
94
110
 
111
+
112
+
113
+ # http to https
114
+
115
+ RewriteCond %{ENV:HTTPS} !^on$
116
+
117
+ RewriteCond %{HTTP:X-Sakura-Forwarded-For} ^$
118
+
119
+ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
120
+
121
+
122
+
95
123
  RewriteRule ^index.php$ - [L]
96
124
 
97
125
 
@@ -108,9 +136,9 @@
108
136
 
109
137
  RewriteRule ^ - [L]
110
138
 
111
- RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
139
+ RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) wordpress/$2 [L]
112
140
 
113
- RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
141
+ RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ wordpress/$2 [L]
114
142
 
115
143
  RewriteRule . index.php [L]
116
144