-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathurl_rewrite.php
More file actions
157 lines (131 loc) · 6.43 KB
/
url_rewrite.php
File metadata and controls
157 lines (131 loc) · 6.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
/******************************************************************************/
// //
// InstantCMS v1.10.6 //
// http://www.instantcms.ru/ //
// //
// written by InstantCMS Team, 2007-2015 //
// produced by InstantSoft, (www.instantsoft.ru) //
// //
// LICENSED BY GNU/GPL v2 //
// //
/******************************************************************************/
//
// ВНИМАНИЕ! Если вы хотите добавить собственное правило, то создайте
// файл custom_rewrite.php и объявите в нем функцию
// custom_rewrite_rules() по аналогии с текущим файлом!
//
// В этом файле определены системные правила для редиректа и подмены адресов
//
// source : регулярное выражение, для сравнения с текущим URI
// target : URI для перенаправления, при совпадении source
// action : действие при совпадении source
//
// Возможные значения для action:
//
// rewrite : подменить URI перед определением компонента
// redirect : редирект на target с кодом 303 See Other
// redirect-301 : редирект на target с кодом 301 Moved Permanently
// alias : заинклудить файл target и остановить скрипт, поддерживаются параметры через file.php?param=value
//
function rewrite_rules(){
$rules[] = array(
'source' => '/^(.+)\/$/ui',
'target' => '/{1}',
'action' => 'redirect-301'
);
//
// Вход / Выход
//
$rules[] = array(
'source' => '/^admin$/ui',
'target' => '/admin/index.php',
'action' => 'redirect'
);
$rules[] = array(
'source' => '/^login$/ui',
'target' => 'registration/login',
'action' => 'rewrite'
);
$rules[] = array(
'source' => '/^logout$/ui',
'target' => 'registration/logout',
'action' => 'rewrite'
);
$rules[] = array(
'source' => '/^auth\/error.html$/ui',
'target' => 'registration/autherror',
'action' => 'rewrite'
);
//
// Регистрация / Активация
//
$rules[] = array(
'source' => '/^activate\/(.+)$/ui',
'target' => 'registration/activate/{1}',
'action' => 'rewrite'
);
$rules[] = array(
'source' => '/^passremind.html$/ui',
'target' => 'registration/passremind',
'action' => 'rewrite'
);
//
// RSS
//
$rules[] = array(
'source' => '/^rss\/([a-z]+)\/(.+)\/feed.rss$/ui',
'target' => 'rssfeed/{1}/{2}',
'action' => 'rewrite'
);
//
// Внешние ссылки
//
$rules[] = array(
'source' => '/^go\/url=(.+)$/ui',
'target' => 'files/go/{1}',
'action' => 'rewrite'
);
$rules[] = array(
'source' => '/^load\/url=(.+)$/ui',
'target' => 'files/load/{1}',
'action' => 'rewrite'
);
$rules[] = array(
'source' => '/^r([0-9]+)$/ui',
'target' => 'billing/ref_link/{1}',
'action' => 'rewrite'
);
//
// Баннеры
//
$rules[] = array(
'source' => '/^gobanner([0-9]+)$/ui',
'target' => 'banners/{1}',
'action' => 'rewrite'
);
//
// Подписка
//
$rules[] = array(
'source' => '/^subscribe\/([a-z_]+)\/([0-9]+)$/ui',
'target' => 'subscribes/{1}/{2}/1',
'action' => 'rewrite'
);
$rules[] = array(
'source' => '/^unsubscribe\/([a-z_]+)\/([0-9]+)$/ui',
'target' => 'subscribes/{1}/{2}/0',
'action' => 'rewrite'
);
$rules[] = array(
'source' => '/^forum\/subscribe([0-9]+).html$/ui',
'target' => 'subscribes/forum/{1}/1',
'action' => 'rewrite'
);
$rules[] = array(
'source' => '/^forum\/unsubscribe([0-9]+).html$/ui',
'target' => 'subscribes/forum/{1}/0',
'action' => 'rewrite'
);
return $rules;
}