質問編集履歴
2
httpに修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,15 +7,15 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
これにより
|
10
|
-
|
10
|
+
http://example.com/city/13/13102/
|
11
11
|
のリンクを踏むと
|
12
|
-
|
12
|
+
http://example.com/city.php?pre_id=13&city_id=13102
|
13
13
|
のPHPの結果を拾ってきます。
|
14
14
|
|
15
15
|
この場合、ホームページに記載するURLは
|
16
|
-
|
16
|
+
http://example.com/city/13/13102/
|
17
17
|
そこを踏んだ場合の、ブラウザに表示されるURLも同様となります。
|
18
|
-
|
18
|
+
http://example.com/city/13/13102/
|
19
19
|
|
20
20
|
|
21
21
|
nginxのrewriteを使って同様のことを行いました。
|
@@ -24,23 +24,23 @@
|
|
24
24
|
rewrite ^/city/(.*)/(.*)/$ /city.php?a2_pre_id=$1&a4_city_id=$2 permanent;
|
25
25
|
```
|
26
26
|
これにより
|
27
|
-
|
27
|
+
http://example.com/city/13/13102/
|
28
28
|
のリンクを踏むと
|
29
|
-
|
29
|
+
http://example.com/city.php?pre_id=13&city_id=13102
|
30
30
|
のPHPの結果を拾ってきます。
|
31
31
|
|
32
32
|
ホームページに記載するリンクのURLは
|
33
|
-
|
33
|
+
http://example.com/city/13/13102/
|
34
34
|
で変わりはありません。
|
35
35
|
|
36
36
|
しかし、そのリンクを踏んだ場合、ブラウザに表示されるURLが、
|
37
|
-
|
37
|
+
http://example.com/city.php?pre_id=13&city_id=13102
|
38
38
|
と、PHPがそのまま表示されてしまうことがわかりました。
|
39
39
|
これでは、折角のrewriteが台無しです。
|
40
40
|
|
41
41
|
【質問】
|
42
42
|
nginxでのrewrite時のブラウザに表示されるURLを
|
43
|
-
|
43
|
+
http://example.com/city/13/13102/
|
44
44
|
にする方法ばありませんでしょうか?
|
45
45
|
|
46
46
|
よろしくお願いいたします。
|
1
誤字修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
これにより
|
10
10
|
ttp://example.com/city/13/13102/
|
11
11
|
のリンクを踏むと
|
12
|
-
ttp://example.com/city.php?
|
12
|
+
ttp://example.com/city.php?pre_id=13&city_id=13102
|
13
13
|
のPHPの結果を拾ってきます。
|
14
14
|
|
15
15
|
この場合、ホームページに記載するURLは
|
@@ -26,17 +26,15 @@
|
|
26
26
|
これにより
|
27
27
|
ttp://example.com/city/13/13102/
|
28
28
|
のリンクを踏むと
|
29
|
-
ttp://example.com/city.php?
|
29
|
+
ttp://example.com/city.php?pre_id=13&city_id=13102
|
30
30
|
のPHPの結果を拾ってきます。
|
31
31
|
|
32
|
-
ホームページに記載するURLは
|
32
|
+
ホームページに記載するリンクのURLは
|
33
33
|
ttp://example.com/city/13/13102/
|
34
34
|
で変わりはありません。
|
35
35
|
|
36
|
-
しかし、そ
|
36
|
+
しかし、そのリンクを踏んだ場合、ブラウザに表示されるURLが、
|
37
|
-
ttp://example.com/city/13/13102/
|
38
|
-
というような変換されたURLではなく、
|
39
|
-
ttp://example.com/city.php?
|
37
|
+
ttp://example.com/city.php?pre_id=13&city_id=13102
|
40
38
|
と、PHPがそのまま表示されてしまうことがわかりました。
|
41
39
|
これでは、折角のrewriteが台無しです。
|
42
40
|
|