質問編集履歴

1

実在するドメインを例にあげているとご指摘をいただき、例示ドメインに変更しました。

2022/03/02 00:49

投稿

R-teratail
R-teratail

スコア10

test CHANGED
File without changes
test CHANGED
@@ -10,14 +10,14 @@
10
10
 
11
11
  ### やりたいこと
12
12
  例.
13
- `https://XXX.com/old-page/index.html`
13
+ `https://example.jp/old-page/index.html`
14
- `https://XXX.com/old-page/1/index.html`
14
+ `https://example.jp/old-page/1/index.html`
15
- `https://XXX.com/old-page/2/index.html`
15
+ `https://example.jp/old-page/2/index.html`
16
- `https://XXX.com/old-page/2/2/index.html`
16
+ `https://example.jp/old-page/2/2/index.html`
17
17
 
18
18
  など、「old-page」以下の旧URLを
19
19
 
20
- `https://XXX.com/page/` へ纏めてリダイレクトさせたい。
20
+ `https://example.jp/page/` へ纏めてリダイレクトさせたい。
21
21
 
22
22
 
23
23
  ### 書いてみた記述(どちらも失敗)
@@ -25,14 +25,14 @@
25
25
  <IfModule mod_rewrite.c>
26
26
  RewriteEngine On
27
27
  RewriteCond %{REQUEST_URI} ^(/old-page/) [NC]
28
- RewriteRule .* https://XXX.com/page/ [R=302]
28
+ RewriteRule .* https://example.jp/page/ [R=302]
29
29
  </IfModule>
30
30
  ```
31
31
  ```htaccess
32
32
  <IfModule mod_rewrite.c>
33
33
  RewriteEngine On
34
34
  RewriteBase /
35
- RewriteRule ^old-page/(.*)$ https://XXX.com/page/ [R=302]
35
+ RewriteRule ^old-page/(.*)$ https://example.jp/page/ [R=302]
36
36
  </IfModule>
37
37
  ```
38
38
  ※うまくリダイレクトされるまでは[302]でテスト中です。