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

質問編集履歴

2

動的について追加

2017/10/23 07:08

投稿

oyashiro
oyashiro

スコア37

title CHANGED
File without changes
body CHANGED
@@ -1,9 +1,9 @@
1
1
  heaccessで複数のリダイレクト処理を行いたいのですがうまくいきません。
2
2
 
3
3
  やりたいことは
4
- http://www.example.com/1.html を http://www.example.com/11.html へリダイレクト、
4
+ http://www.example.com/?act=1 を http://www.example.com/11.html へリダイレクト、
5
- http://www.example.com/2.html を http://www.example.com/22.html へリダイレクト
5
+ http://www.example.com/?act=2 を http://www.example.com/22.html へリダイレクト
6
- http://www.example.com/3.html を http://www.example.com/33.html へリダイレクトです。
6
+ http://www.example.com/?act=3 を http://www.example.com/33.html へリダイレクトです。
7
7
 
8
8
  下記のよう記載しましたがダメでした。
9
9
 
@@ -20,9 +20,9 @@
20
20
  RewriteCond %{REQUEST_FILENAME} !^(.*).(gif|png|jpe?g|css|ico|js|svg)$ [NC]
21
21
  RewriteRule ^(.*)$ index.php [QSA]
22
22
 
23
- RewriteRule ^1.html$ http://www.example.com/11.html [R=301]
23
+ RewriteRule ^?act=11$ http://www.example.com/11.html [R=301]
24
- RewriteRule ^2.html$ http://www.example.com/22.html [R=301]
24
+ RewriteRule ^?act=22$ http://www.example.com/22.html [R=301]
25
- RewriteRule ^3.html$ http://www.example.com/33.html [R=301,L]
25
+ RewriteRule ^?act=33$ http://www.example.com/33.html [R=301,L]
26
26
 
27
27
  </IfModule>
28
28
 

1

コード修正

2017/10/23 07:08

投稿

oyashiro
oyashiro

スコア37

title CHANGED
File without changes
body CHANGED
@@ -1,9 +1,9 @@
1
1
  heaccessで複数のリダイレクト処理を行いたいのですがうまくいきません。
2
2
 
3
3
  やりたいことは
4
- http://●●.jp/1 を http://●●.co.jp/1 へリダイレクト、
4
+ http://www.example.com/1.html を http://www.example.com/11.html へリダイレクト、
5
- http://●●.jp/2 を http://●●.co.jp/2 へリダイレクト
5
+ http://www.example.com/2.html を http://www.example.com/22.html へリダイレクト
6
- http://●●.jp/3 を http://●●.co.jp/3 へリダイレクトです。
6
+ http://www.example.com/3.html を http://www.example.com/33.html へリダイレクトです。
7
7
 
8
8
  下記のよう記載しましたがダメでした。
9
9
 
@@ -18,11 +18,11 @@
18
18
 
19
19
  RewriteCond %{REQUEST_FILENAME} !-f
20
20
  RewriteCond %{REQUEST_FILENAME} !^(.*).(gif|png|jpe?g|css|ico|js|svg)$ [NC]
21
- RewriteRule ^(.*)$ index.php [QSA,L]
21
+ RewriteRule ^(.*)$ index.php [QSA]
22
22
 
23
+ RewriteRule ^1.html$ http://www.example.com/11.html [R=301]
24
+ RewriteRule ^2.html$ http://www.example.com/22.html [R=301]
23
- RewriteRule ^http://●●.jp/1$ http://●●.co.jp/1 [R=301,L]
25
+ RewriteRule ^3.html$ http://www.example.com/33.html [R=301,L]
24
- RewriteRule ^http://●●.jp/2$ http://●●.co.jp/2 [R=301,L]
25
- RewriteRule ^http://●●.jp/3$ http://●●.co.jp/3 [R=301,L]
26
26
 
27
27
  </IfModule>
28
28