teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

文章変更

2021/03/15 05:29

投稿

satoshi5555
satoshi5555

スコア18

title CHANGED
File without changes
body CHANGED
@@ -47,17 +47,25 @@
47
47
  で{/%postname%/}のトレイングスラッシュを消し{/%postname% }
48
48
 
49
49
  .htaccessのssl化に追記で
50
+ ```
50
51
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
52
+ ```
51
53
  にトレイングスラッシュを書いてみました。↓(ssl化とトレイングスラッシュ同時です)
54
+ ```
52
55
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}/ [R=301,L]
53
56
 
57
+ ```
58
+ 変更後です↓
59
+ ```
54
60
  <IfModule mod_rewrite.c>
55
61
  RewriteEngine On
56
62
  RewriteBase /
57
63
  RewriteCond %{HTTPS} !on
58
64
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}/ [R=301,L]
59
65
  </IfModule>
66
+ ```
60
67
 
68
+
61
69
  すると、
62
70
  http://test/aaaaa
63
71
  ↓ 

2

文章変更

2021/03/15 05:29

投稿

satoshi5555
satoshi5555

スコア18

title CHANGED
File without changes
body CHANGED
@@ -11,13 +11,14 @@
11
11
  とリダイレクトをします。 (一回のリダイレクト)
12
12
 
13
13
  .htaccessでssl化の記述です。
14
-
14
+ ```
15
15
  <IfModule mod_rewrite.c>
16
16
  RewriteEngine On
17
17
  RewriteBase /
18
18
  RewriteCond %{HTTPS} !on
19
19
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
20
20
  </IfModule>
21
+ ```
21
22
 
22
23
  しかし、
23
24
  https://test/aaaaa/

1

文章変更

2021/03/15 05:27

投稿

satoshi5555
satoshi5555

スコア18

title CHANGED
File without changes
body CHANGED
@@ -1,8 +1,75 @@
1
1
  wordpressのリダイレクトを調査していまして、
2
2
 
3
- http://test というサイトがあり、これが
3
+ https://test/
4
+ というサイトがあったとします。
5
+ これをsと/を無しにして
6
+ http://test
7
+ でリダイレクト調査をすると
8
+ http://test
9
+
4
- https://test  とSSL化したリダイレクトを行なっています。この後、
10
+ https://test/
5
- https://test/ トレイングスラッシュありに2回リダイレクトをしているのでが、
11
+ とリダイレクトをし。 (一回のリダイレクト)
6
12
 
13
+ .htaccessでssl化の記述です。
14
+
15
+ <IfModule mod_rewrite.c>
16
+ RewriteEngine On
17
+ RewriteBase /
18
+ RewriteCond %{HTTPS} !on
19
+ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
20
+ </IfModule>
21
+
22
+ しかし、
23
+ https://test/aaaaa/
24
+ と言うページの
25
+ これをsと/を無しにして
26
+ http://test/aaaaa
27
+ でリダイレクト調査をすると
28
+
29
+ http://test/aaaaa
30
+
31
+ https://test/aaaaa
32
+
33
+ https://test/aaaaa/
34
+
35
+ と2回リダイレクトしてしまいます。
36
+
37
+ 2回のリダイレクトはseo的に好ましくないと言う事で1回にしたいところです。
38
+
39
+ http://test/aaaaa
40
+ ↓ これにしたい
41
+ https://test/aaaaa/
42
+
43
+ その為、
44
+ wordpressのパーマリンク設定で
45
+ カスタム構造 https://test.jp {/%postname%/}←記述場所
46
+ で{/%postname%/}のトレイングスラッシュを消し{/%postname% }
47
+
48
+ .htaccessのssl化に追記で
49
+ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
50
+ にトレイングスラッシュを書いてみました。↓(ssl化とトレイングスラッシュ同時です)
51
+ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}/ [R=301,L]
52
+
53
+ <IfModule mod_rewrite.c>
54
+ RewriteEngine On
55
+ RewriteBase /
56
+ RewriteCond %{HTTPS} !on
57
+ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}/ [R=301,L]
58
+ </IfModule>
59
+
60
+ すると、
61
+ http://test/aaaaa
62
+ ↓ 
63
+ https://test/aaaaa/
64
+ はなって出来たと思ったのですが、
65
+
66
+ トップページは
7
- http://test から
67
+ http://test
68
+ ↓ 
8
- https://test/ へと1回のリダイレクトへ変更する方法ありますでしょうか?
69
+ https://test//
70
+
71
+ http://test/
72
+ となってしまいました。
73
+
74
+ 全ページをリダイレクトを1回にしたいのですが、調べても見つからず分からなくて困っています。
75
+ よろしくお願いいたします。