回答編集履歴
2
サンプルソース追加してみました
test
CHANGED
@@ -8,6 +8,56 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
+
|
12
|
+
|
13
|
+
以下追記------
|
14
|
+
|
15
|
+
`HEAD`を取得してサイトの有無を確認
|
16
|
+
|
17
|
+
```php
|
18
|
+
|
19
|
+
$site = 'http://www.poooooooo.com/';
|
20
|
+
|
21
|
+
$header = @get_headers($site);
|
22
|
+
|
23
|
+
if (preg_match('/^HTTP¥/.*¥s+200¥s/i', $header[0])) {
|
24
|
+
|
25
|
+
//存在する場合の処理
|
26
|
+
|
27
|
+
} else {
|
28
|
+
|
29
|
+
header("Location: リダイレクト先のURL");
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
```
|
36
|
+
|
37
|
+
```php
|
38
|
+
|
39
|
+
function logincheck(){
|
40
|
+
|
41
|
+
//省略
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
if(logincheck()){
|
48
|
+
|
49
|
+
//ログインしていた場合の処理
|
50
|
+
|
51
|
+
}else{
|
52
|
+
|
53
|
+
header("Location: リダイレクト先のURL");
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
|
60
|
+
|
11
61
|
//javascriptの場合
|
12
62
|
|
13
63
|
location.href = "フルパス";
|
1
追記でーす
test
CHANGED
@@ -11,3 +11,7 @@
|
|
11
11
|
//javascriptの場合
|
12
12
|
|
13
13
|
location.href = "フルパス";
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
.htaccessは条件分岐の処理には不向きかと...
|