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

質問編集履歴

1

試したコードの一部 追記

2019/05/15 12:26

投稿

shinnnn
shinnnn

スコア15

title CHANGED
File without changes
body CHANGED
@@ -8,23 +8,30 @@
8
8
  試したこと
9
9
  ```
10
10
  エックスサーバー機能のサイト転送設定(Redirect permanent)や.htaccessの編集(mod_rewrite)など試しましたが、うまくいきませんでした。
11
+ 以下は試したコードの一部ではありますが。こちらをpublic_html内の.htaccessに記載。
12
+ <IfModule mod_rewrite.c>
13
+ RewriteEngine On
14
+ RewriteCond %{HTTP_HOST} ^www.xxxx.com$ [OR]
15
+ RewriteCond %{HTTP_HOST} !=sub.xxxx.com$
16
+ RewriteRule /old http://xxxx.com/new [R=301,L]
17
+ </IfModule>
11
18
  ```
12
19
 
13
20
  問題点1
14
21
  ```
15
22
  下の階層のリダイレクトがうまくいかない。
16
- http://xxxx/old -> http://xxxx/new
23
+ http://xxxx.com/old -> http://xxxx.com/new
17
- http://xxxx/old/old2 -> http://xxxx/new
24
+ http://xxxx.com/old/old2 -> http://xxxx.com/new
18
25
  としたいが、
19
- http://xxxx/old -> http://xxxx/new
26
+ http://xxxx.com/old -> http://xxxx.com/new
20
- http://xxxx/old/old2 -> http://xxxx/new/old2
27
+ http://xxxx.com/old/old2 -> http://xxxx.com/new/old2
21
28
  となってしまう。
22
29
  ```
23
30
 
24
31
  問題点2
25
32
  ```
26
33
  サブドメインはリダイレクトさせたくないが、影響してしまう。
27
- http://xxxx/old -> http://xxxx/new
34
+ http://xxxx.com/old -> http://xxxx.com/new
28
- http://sub.xxxx/old -> http://xxxx/new
35
+ http://sub.xxxx.com/old -> http://xxxx.com/new
29
36
  となってしまう。
30
37
  ```