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

質問編集履歴

3

質問追加しました。

2016/07/25 08:39

投稿

komachi168
komachi168

スコア18

title CHANGED
File without changes
body CHANGED
@@ -13,6 +13,25 @@
13
13
 
14
14
  よろしくお願いいたします。
15
15
 
16
+
17
+ 追記です。
18
+ %{REQUEST_URI}を下記URLで設定したい場合、
19
+ http://example.com/api/sample/test/dl/?user=tanaka&age=23&email=test@test.com
20
+
21
+ sampleがコントローラーになっていて、/test/dl/はメソッドになっています。
22
+ この時ですが、どのように%{REQUEST_URI}を設定すればよろしいでしょうか?
23
+ ```ここに言語を入力
24
+ RewriteEngine On
25
+ RewriteCond %{REQUEST_URI} ^/sample/test/dl/ [NC]
26
+ RewriteCond %{QUERY_STRING} user=(.*)&age=(.*)&email=(.*)
27
+ RewriteRule index.php(.*)$ http://example.jp/test/index.php?user=tanaka&age=23&email=test@test.com
28
+ ```
29
+
30
+ 上記の書き方で問題ないでしょうか?
31
+ よろしくお願いいたします。
32
+
33
+
34
+
16
35
  ###書いたソース
17
36
 
18
37
  ```ここに言語を入力
@@ -23,6 +42,8 @@
23
42
  ```
24
43
 
25
44
 
45
+
46
+
26
47
  ###補足情報(言語/FW/ツール等のバージョンなど)
27
48
  php 5.3.29
28
49
  cakephp 2.4.10

2

ソースの編集

2016/07/25 08:39

投稿

komachi168
komachi168

スコア18

title CHANGED
File without changes
body CHANGED
@@ -15,10 +15,12 @@
15
15
 
16
16
  ###書いたソース
17
17
 
18
+ ```ここに言語を入力
18
19
  RewriteEngine On
19
20
  RewriteCond %{REQUEST_URI} ^/sample/index.php [NC]
20
21
  RewriteCond %{QUERY_STRING} user=(.*)&age=(.*)&email=(.*)
21
22
  RewriteRule index.php(.*)$ http://example.jp/test/index.php?user=tanaka&age=23&email=test@test.com
23
+ ```
22
24
 
23
25
 
24
26
  ###補足情報(言語/FW/ツール等のバージョンなど)

1

ソースの追加

2016/07/25 04:13

投稿

komachi168
komachi168

スコア18

title CHANGED
File without changes
body CHANGED
@@ -4,16 +4,23 @@
4
4
 
5
5
  イメージとしましては、
6
6
 
7
- 1, http://test.com/sample/index.php?user=tanaka&age=23&email=test@test.com
7
+ 1, http://example.com/sample/index.php?user=tanaka&age=23&email=test@test.com
8
8
 
9
- 2, http://hogehoge.com/test/index.php?user=tanaka&age=23&email=test@test.com
9
+ 2, http://example.jp/test/index.php?user=tanaka&age=23&email=test@test.com
10
10
 
11
11
  やりたいことですが、1にアクセスされたら2にパラメータごとリダイレクトして
12
12
  パラメータの値を2のDBに格納したいです。
13
13
 
14
14
  よろしくお願いいたします。
15
15
 
16
+ ###書いたソース
16
17
 
18
+ RewriteEngine On
19
+ RewriteCond %{REQUEST_URI} ^/sample/index.php [NC]
20
+ RewriteCond %{QUERY_STRING} user=(.*)&age=(.*)&email=(.*)
21
+ RewriteRule index.php(.*)$ http://example.jp/test/index.php?user=tanaka&age=23&email=test@test.com
22
+
23
+
17
24
  ###補足情報(言語/FW/ツール等のバージョンなど)
18
25
  php 5.3.29
19
26
  cakephp 2.4.10