| 1 | <?php |
|---|
| 2 | /******************************************************************************/ |
|---|
| 3 | // // |
|---|
| 4 | // InstantCMS v1.8 // |
|---|
| 5 | // http://www.instantcms.ru/ // |
|---|
| 6 | // // |
|---|
| 7 | // written by InstantCMS Team, 2007-2010 // |
|---|
| 8 | // produced by InstantSoft, (www.instantsoft.ru) // |
|---|
| 9 | // // |
|---|
| 10 | // LICENSED BY GNU/GPL v2 // |
|---|
| 11 | // // |
|---|
| 12 | /******************************************************************************/ |
|---|
| 13 | |
|---|
| 14 | // |
|---|
| 15 | // ÂÍÈÌÀÍÈÅ! Åñëè âû õîòèòå äîáàâèòü ñîáñòâåííîå ïðàâèëî, òî ñîçäàéòå |
|---|
| 16 | // ôàéë custom_rewrite.php è îáúÿâèòå â íåì ôóíêöèþ |
|---|
| 17 | // custom_rewrite_rules() ïî àíàëîãèè ñ òåêóùèì ôàéëîì! |
|---|
| 18 | // |
|---|
| 19 | // Â ýòîì ôàéëå îïðåäåëåíû ñèñòåìíûå ïðàâèëà äëÿ ðåäèðåêòà è ïîäìåíû àäðåñîâ |
|---|
| 20 | // |
|---|
| 21 | // source : ðåãóëÿðíîå âûðàæåíèå, äëÿ ñðàâíåíèÿ ñ òåêóùèì URI |
|---|
| 22 | // target : URI äëÿ ïåðåíàïðàâëåíèÿ, ïðè ñîâïàäåíèè source |
|---|
| 23 | // action : äåéñòâèå ïðè ñîâïàäåíèè source |
|---|
| 24 | // |
|---|
| 25 | // Âîçìîæíûå çíà÷åíèÿ äëÿ action: |
|---|
| 26 | // |
|---|
| 27 | // rewrite : ïîäìåíèòü URI ïåðåä îïðåäåëåíèåì êîìïîíåíòà |
|---|
| 28 | // redirect : ðåäèðåêò íà target ñ êîäîì 303 See Other |
|---|
| 29 | // redirect-301 : ðåäèðåêò íà target ñ êîäîì 301 Moved Permanently |
|---|
| 30 | // alias : çàèíêëóäèòü ôàéë target è îñòàíîâèòü ñêðèïò |
|---|
| 31 | // |
|---|
| 32 | |
|---|
| 33 | function rewrite_rules(){ |
|---|
| 34 | |
|---|
| 35 | // |
|---|
| 36 | // Âõîä / Âûõîä |
|---|
| 37 | // |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | $rules[] = array( |
|---|
| 41 | 'source' => '/^admin$/i', |
|---|
| 42 | 'target' => '/admin/index.php', |
|---|
| 43 | 'action' => 'redirect' |
|---|
| 44 | ); |
|---|
| 45 | |
|---|
| 46 | $rules[] = array( |
|---|
| 47 | 'source' => '/^login$/i', |
|---|
| 48 | 'target' => 'registration/login', |
|---|
| 49 | 'action' => 'rewrite' |
|---|
| 50 | ); |
|---|
| 51 | |
|---|
| 52 | $rules[] = array( |
|---|
| 53 | 'source' => '/^logout$/i', |
|---|
| 54 | 'target' => 'registration/logout', |
|---|
| 55 | 'action' => 'rewrite' |
|---|
| 56 | ); |
|---|
| 57 | |
|---|
| 58 | $rules[] = array( |
|---|
| 59 | 'source' => '/^auth\/error.html$/i', |
|---|
| 60 | 'target' => 'registration/autherror', |
|---|
| 61 | 'action' => 'rewrite' |
|---|
| 62 | ); |
|---|
| 63 | |
|---|
| 64 | $rules[] = array( |
|---|
| 65 | 'source' => '/^go\/url=(.+)$/i', |
|---|
| 66 | 'target' => 'files/go/{1}', |
|---|
| 67 | 'action' => 'rewrite' |
|---|
| 68 | ); |
|---|
| 69 | |
|---|
| 70 | $rules[] = array( |
|---|
| 71 | 'source' => '/^load\/url=(.+)$/i', |
|---|
| 72 | 'target' => 'files/load/{1}', |
|---|
| 73 | 'action' => 'rewrite' |
|---|
| 74 | ); |
|---|
| 75 | |
|---|
| 76 | // |
|---|
| 77 | // Ðåãèñòðàöèÿ / Àêòèâàöèÿ |
|---|
| 78 | // |
|---|
| 79 | |
|---|
| 80 | $rules[] = array( |
|---|
| 81 | 'source' => '/^registration\/complete.html$/i', |
|---|
| 82 | 'target' => '/core/auth/regcomplete.html', |
|---|
| 83 | 'action' => 'alias' |
|---|
| 84 | ); |
|---|
| 85 | |
|---|
| 86 | $rules[] = array( |
|---|
| 87 | 'source' => '/^registration\/activate.html$/i', |
|---|
| 88 | 'target' => '/core/auth/regactivate.html', |
|---|
| 89 | 'action' => 'alias' |
|---|
| 90 | ); |
|---|
| 91 | |
|---|
| 92 | $rules[] = array( |
|---|
| 93 | 'source' => '/^activate\/(.+)$/i', |
|---|
| 94 | 'target' => 'registration/activate/{1}', |
|---|
| 95 | 'action' => 'rewrite' |
|---|
| 96 | ); |
|---|
| 97 | |
|---|
| 98 | $rules[] = array( |
|---|
| 99 | 'source' => '/^passremind.html$/i', |
|---|
| 100 | 'target' => 'registration/passremind', |
|---|
| 101 | 'action' => 'rewrite' |
|---|
| 102 | ); |
|---|
| 103 | |
|---|
| 104 | // |
|---|
| 105 | // RSS |
|---|
| 106 | // |
|---|
| 107 | |
|---|
| 108 | $rules[] = array( |
|---|
| 109 | 'source' => '/^rss\/([a-z]+)\/(.+)\/feed.rss$/i', |
|---|
| 110 | 'target' => 'rssfeed/{1}/{2}', |
|---|
| 111 | 'action' => 'rewrite' |
|---|
| 112 | ); |
|---|
| 113 | |
|---|
| 114 | // |
|---|
| 115 | // Âíåøíèå ññûëêè |
|---|
| 116 | // |
|---|
| 117 | |
|---|
| 118 | $rules[] = array( |
|---|
| 119 | 'source' => '/^go\/url=(.+)$/i', |
|---|
| 120 | 'target' => 'files/go/{1}', |
|---|
| 121 | 'action' => 'rewrite' |
|---|
| 122 | ); |
|---|
| 123 | |
|---|
| 124 | $rules[] = array( |
|---|
| 125 | 'source' => '/^load\/url=(.+)$/i', |
|---|
| 126 | 'target' => 'files/load/{1}', |
|---|
| 127 | 'action' => 'rewrite' |
|---|
| 128 | ); |
|---|
| 129 | |
|---|
| 130 | $rules[] = array( |
|---|
| 131 | 'source' => '/^r([0-9]+)$/i', |
|---|
| 132 | 'target' => 'billing/ref_link/{1}', |
|---|
| 133 | 'action' => 'rewrite' |
|---|
| 134 | ); |
|---|
| 135 | |
|---|
| 136 | // |
|---|
| 137 | // Áàííåðû |
|---|
| 138 | // |
|---|
| 139 | |
|---|
| 140 | $rules[] = array( |
|---|
| 141 | 'source' => '/^gobanner([0-9]+)$/i', |
|---|
| 142 | 'target' => 'banners/{1}', |
|---|
| 143 | 'action' => 'rewrite' |
|---|
| 144 | ); |
|---|
| 145 | |
|---|
| 146 | // |
|---|
| 147 | // Ïîäïèñêà |
|---|
| 148 | // |
|---|
| 149 | |
|---|
| 150 | $rules[] = array( |
|---|
| 151 | 'source' => '/^subscribe\/([a-z]+)\/([0-9]+)$/i', |
|---|
| 152 | 'target' => 'subscribes/{1}/{2}/1', |
|---|
| 153 | 'action' => 'rewrite' |
|---|
| 154 | ); |
|---|
| 155 | |
|---|
| 156 | $rules[] = array( |
|---|
| 157 | 'source' => '/^unsubscribe\/([a-z]+)\/([0-9]+)$/i', |
|---|
| 158 | 'target' => 'subscribes/{1}/{2}/0', |
|---|
| 159 | 'action' => 'rewrite' |
|---|
| 160 | ); |
|---|
| 161 | |
|---|
| 162 | $rules[] = array( |
|---|
| 163 | 'source' => '/^forum\/subscribe([0-9]+).html$/i', |
|---|
| 164 | 'target' => 'subscribes/forum/{1}/1', |
|---|
| 165 | 'action' => 'rewrite' |
|---|
| 166 | ); |
|---|
| 167 | |
|---|
| 168 | $rules[] = array( |
|---|
| 169 | 'source' => '/^forum\/unsubscribe([0-9]+).html$/i', |
|---|
| 170 | 'target' => 'subscribes/forum/{1}/0', |
|---|
| 171 | 'action' => 'rewrite' |
|---|
| 172 | ); |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | // |
|---|
| 176 | // Ñòàðûå àäðåñà ñòàòåé è ðàçäåëîâ (1.5.x) |
|---|
| 177 | // |
|---|
| 178 | |
|---|
| 179 | $rules[] = array( |
|---|
| 180 | 'source' => '/^content\/(.+)\/page\-([0-9]+).html$/i', |
|---|
| 181 | 'target' => '/{1}/page-{2}.html', |
|---|
| 182 | 'action' => 'redirect-301' |
|---|
| 183 | ); |
|---|
| 184 | |
|---|
| 185 | $rules[] = array( |
|---|
| 186 | 'source' => '/^content\/(.+)\/page\-([0-9]+)$/i', |
|---|
| 187 | 'target' => '/{1}/page-{2}', |
|---|
| 188 | 'action' => 'redirect-301' |
|---|
| 189 | ); |
|---|
| 190 | |
|---|
| 191 | $rules[] = array( |
|---|
| 192 | 'source' => '/^content\/([0-9]+)\/(.+).html$/i', |
|---|
| 193 | 'target' => '/{2}.html', |
|---|
| 194 | 'action' => 'redirect-301' |
|---|
| 195 | ); |
|---|
| 196 | |
|---|
| 197 | $rules[] = array( |
|---|
| 198 | 'source' => '/^content\/([0-9]+)\/(.+)$/i', |
|---|
| 199 | 'target' => '/{2}', |
|---|
| 200 | 'action' => 'redirect-301' |
|---|
| 201 | ); |
|---|
| 202 | |
|---|
| 203 | $rules[] = array( |
|---|
| 204 | 'source' => '/^content\/(.+)$/i', |
|---|
| 205 | 'target' => '/{1}', |
|---|
| 206 | 'action' => 'redirect-301' |
|---|
| 207 | ); |
|---|
| 208 | |
|---|
| 209 | $rules[] = array( |
|---|
| 210 | 'source' => '/^content\/([0-9]+)\/(.+)\/page\-([0-9]+).html$/i', |
|---|
| 211 | 'target' => '/{2}/page-{3}.html', |
|---|
| 212 | 'action' => 'redirect-301' |
|---|
| 213 | ); |
|---|
| 214 | |
|---|
| 215 | $rules[] = array( |
|---|
| 216 | 'source' => '/^content\/([0-9]+)\/(.+)\/page\-([0-9]+)$/i', |
|---|
| 217 | 'target' => '/{2}/page-{3}', |
|---|
| 218 | 'action' => 'redirect-301' |
|---|
| 219 | ); |
|---|
| 220 | |
|---|
| 221 | $rules[] = array( |
|---|
| 222 | 'source' => '/^(.+)\/$/i', |
|---|
| 223 | 'target' => '/{1}', |
|---|
| 224 | 'action' => 'redirect-301' |
|---|
| 225 | ); |
|---|
| 226 | |
|---|
| 227 | // |
|---|
| 228 | // Ñòàðûå àäðåñà ïîñòîâ è áëîãîâ (1.5.x) |
|---|
| 229 | // |
|---|
| 230 | |
|---|
| 231 | $rules[] = array( |
|---|
| 232 | 'source' => '/^blogs\/([0-9]+)\/([a-zA-Z0-9\-]+)$/i', |
|---|
| 233 | 'target' => '/blogs/{2}', |
|---|
| 234 | 'action' => 'redirect-301' |
|---|
| 235 | ); |
|---|
| 236 | |
|---|
| 237 | $rules[] = array( |
|---|
| 238 | 'source' => '/^blogs\/([0-9]+)\/([a-zA-Z0-9\-]+)\/$/i', |
|---|
| 239 | 'target' => '/blogs/{2}', |
|---|
| 240 | 'action' => 'redirect-301' |
|---|
| 241 | ); |
|---|
| 242 | |
|---|
| 243 | $rules[] = array( |
|---|
| 244 | 'source' => '/^blogs\/([0-9]+)\/([a-zA-Z0-9\-]+)\/page\-([0-9]+)$/i', |
|---|
| 245 | 'target' => '/blogs/{2}/page-{3}', |
|---|
| 246 | 'action' => 'redirect-301' |
|---|
| 247 | ); |
|---|
| 248 | |
|---|
| 249 | $rules[] = array( |
|---|
| 250 | 'source' => '/^blogs\/([0-9]+)\/([a-zA-Z0-9\-]+)\/cat\-([0-9]+)$/i', |
|---|
| 251 | 'target' => '/blogs/{2}/cat-{3}', |
|---|
| 252 | 'action' => 'redirect-301' |
|---|
| 253 | ); |
|---|
| 254 | |
|---|
| 255 | $rules[] = array( |
|---|
| 256 | 'source' => '/^blogs\/([0-9]+)\/([a-zA-Z0-9\-]+)\/page\-([0-9]+)\/cat\-([0-9]+)$/i', |
|---|
| 257 | 'target' => '/blogs/{2}/page-{3}/cat-{4}', |
|---|
| 258 | 'action' => 'redirect-301' |
|---|
| 259 | ); |
|---|
| 260 | |
|---|
| 261 | $rules[] = array( |
|---|
| 262 | 'source' => '/^blogs\/([0-9]+)\/([a-zA-Z0-9\-]+)\/([a-zA-Z0-9\-]+).html$/i', |
|---|
| 263 | 'target' => '/blogs/{2}/{3}.html', |
|---|
| 264 | 'action' => 'redirect-301' |
|---|
| 265 | ); |
|---|
| 266 | |
|---|
| 267 | // |
|---|
| 268 | // Ñòàðûå àäðåñà ôîðóìà (1.5.x) |
|---|
| 269 | // |
|---|
| 270 | |
|---|
| 271 | $rules[] = array( |
|---|
| 272 | 'source' => '/^forum\/([0-9]+)\/([0-9]+)$/i', |
|---|
| 273 | 'target' => '/forum/{2}', |
|---|
| 274 | 'action' => 'redirect-301' |
|---|
| 275 | ); |
|---|
| 276 | |
|---|
| 277 | $rules[] = array( |
|---|
| 278 | 'source' => '/^forum\/([0-9]*)\/([0-9]*)-([0-9]*)$/i', |
|---|
| 279 | 'target' => '/forum/{2}-{3}', |
|---|
| 280 | 'action' => 'redirect-301' |
|---|
| 281 | ); |
|---|
| 282 | |
|---|
| 283 | $rules[] = array( |
|---|
| 284 | 'source' => '/^forum\/([0-9]*)\/thread([0-9]+).html$/i', |
|---|
| 285 | 'target' => '/forum/thread{2}.html', |
|---|
| 286 | 'action' => 'redirect-301' |
|---|
| 287 | ); |
|---|
| 288 | |
|---|
| 289 | $rules[] = array( |
|---|
| 290 | 'source' => '/^forum\/([0-9]*)\/thread([0-9]+)\-([0-9]+).html$/i', |
|---|
| 291 | 'target' => '/forum/thread{2}-{3}.html', |
|---|
| 292 | 'action' => 'redirect-301' |
|---|
| 293 | ); |
|---|
| 294 | |
|---|
| 295 | // |
|---|
| 296 | // Ñòàðûå àäðåñà êàòàëîãà (1.5.x) |
|---|
| 297 | // |
|---|
| 298 | |
|---|
| 299 | $rules[] = array( |
|---|
| 300 | 'source' => '/^catalog\/([0-9]+)\/([0-9]+)$/i', |
|---|
| 301 | 'target' => '/catalog/{2}', |
|---|
| 302 | 'action' => 'redirect-301' |
|---|
| 303 | ); |
|---|
| 304 | |
|---|
| 305 | $rules[] = array( |
|---|
| 306 | 'source' => '/^catalog\/([0-9]*)\/([0-9]*)-([0-9]*)$/i', |
|---|
| 307 | 'target' => '/catalog/{2}-{3}', |
|---|
| 308 | 'action' => 'redirect-301' |
|---|
| 309 | ); |
|---|
| 310 | |
|---|
| 311 | $rules[] = array( |
|---|
| 312 | 'source' => '/^catalog\/([0-9]*)\/item([0-9]+).html$/i', |
|---|
| 313 | 'target' => '/catalog/item{2}.html', |
|---|
| 314 | 'action' => 'redirect-301' |
|---|
| 315 | ); |
|---|
| 316 | |
|---|
| 317 | return $rules; |
|---|
| 318 | |
|---|
| 319 | } |
|---|
| 320 | |
|---|
| 321 | ?> |
|---|