質問編集履歴
2
タイトル変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.htaccess
|
1
|
+
.htaccessのRewriteCondの書き方
|
test
CHANGED
File without changes
|
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,52 +1,26 @@
|
|
1
1
|
###前提・実現したいこと
|
2
2
|
|
3
|
-
|
3
|
+
ZendFrameWork1系で開発したシステムで.htaccessを使用し、特定のモジュール以外をhttpsへリダイレクトしたい。
|
4
|
-
|
5
|
-
.htaccessを使用して実現したい。
|
6
4
|
|
7
5
|
|
8
6
|
|
9
|
-
|
7
|
+
具体的には
|
10
8
|
|
11
|
-
|
9
|
+
http://hogehoge.com -> https://hogehoge.comへリダイレクトしたい
|
12
10
|
|
13
|
-
|
11
|
+
デフォルトモジュールのfooコントローラのbarアクション
|
14
12
|
|
15
|
-
php
|
13
|
+
http://hogehoge.com/foo/bar -> https://hogehoge.com/foo/barへリダイレクトしたい
|
16
14
|
|
17
|
-
a
|
15
|
+
nonsslモジュールのfooコントローラのbarアクション
|
16
|
+
|
17
|
+
http://hogehoge.com/nonssl/foo/bar nonsslモジュールはリダイレクトしたくない
|
18
18
|
|
19
19
|
|
20
20
|
|
21
21
|
###現状
|
22
22
|
|
23
|
-
例として、
|
24
|
-
|
25
|
-
ドメイン:hogehoge.com
|
26
|
-
|
27
|
-
zendframeworkのモジュールはdefaultとnonsslというモジュールがある場合、
|
28
|
-
|
29
|
-
デフォルトのrouterを使用している場合
|
30
|
-
|
31
|
-
|
23
|
+
```lang-言語名
|
32
|
-
|
33
|
-
http://hogehoge.com
|
34
|
-
|
35
|
-
デフォルトモジュールのfooコントローラのbarアクションのURLは
|
36
|
-
|
37
|
-
http://hogehoge.com/foo/bar
|
38
|
-
|
39
|
-
nonsslモジュールのfooコントローラのbarアクションのURLは
|
40
|
-
|
41
|
-
http://hogehoge.com/nonssl/foo/bar
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
となりますが、
|
46
|
-
|
47
|
-
nonsslモジュール以外はすべてhttpsにリダイレクトしたいと思い、.htaccessに以下のように記述しました
|
48
|
-
|
49
|
-
ーーーーーー
|
50
24
|
|
51
25
|
RewriteEngine On
|
52
26
|
|
@@ -76,19 +50,17 @@
|
|
76
50
|
|
77
51
|
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
|
78
52
|
|
53
|
+
```
|
79
54
|
|
80
55
|
|
81
|
-
ーーーーー
|
82
56
|
|
83
|
-
|
57
|
+
上記のように.htaccessに記載すると
|
84
58
|
|
85
59
|
http://hogehoge.com/foo/barは目的とおりhttpsへリダイレクトされる
|
86
60
|
|
87
61
|
http://hogehoge.com/nonssl/foo/barも目的とおりリダイレクトされない
|
88
62
|
|
89
|
-
|
90
|
-
|
91
|
-
|
63
|
+
しかし
|
92
64
|
|
93
65
|
http://hogehoge.comがhttpsへリダイレクトされません。
|
94
66
|
|
@@ -101,3 +73,15 @@
|
|
101
73
|
|
102
74
|
|
103
75
|
よろしくお願いします。
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
###環境
|
80
|
+
|
81
|
+
OS:centos6
|
82
|
+
|
83
|
+
zendframework 1.12
|
84
|
+
|
85
|
+
php 5.3.3
|
86
|
+
|
87
|
+
apache 2.2.15
|