...
{
"class": "sidebar_container",
// $base02: #073642
"layer0.tint": [7,54,66],
"layer0.opacity": 1.0,
"layer0.draw_center": false,
"layer0.inner_margin": [0, 0, 1, 0],
"content_margin": [0, 0, 1, 0]
},
{
"class": "sidebar_tree",
"row_padding": [8, 3],
"indent": 12,
"indent_offset": 17,
"indent_top_level": false,
// $base2: #eee8d5
"layer0.tint": [238,232,213],
"layer0.opacity": 1.0,
"dark_content": false
},
{
"class": "sidebar_heading",
// $base1: #93a1a1
"color": [147,161,161],
"font.bold": true,
// $base3: #fdf6e3
"shadow_color": [253,246,227],
"shadow_offset": [0, 1]
},
{
"class": "sidebar_heading",
"parents":
[
{ "class": "tree_row", "attributes": ["selected"] }
],
"shadow_color": [160, 174, 192]
},
{
"class": "sidebar_label",
// $base01: #586e75
"color": [88,110,117],
"font.bold": false
// , "shadow_color": [250, 250, 250], "shadow_offset": [0, 0]
},
{
"class": "sidebar_label",
"parents": [{"class": "tree_row", "attributes": ["selected"]}],
// $base01: #586e75
"color": [88,110,117]
// , "shadow_color": [60, 60, 60], "shadow_offset": [0, 1]
},
{
"class": "sidebar_label",
"parents": [{"class": "tree_row", "attributes": ["expandable"]}],
"settings": ["bold_folder_labels"],
"font.bold": true
}
...
<?php
/**
* Простой роутер
* @devg
*/
final class RouterLite {
public static $routes = array();
private static $params = array();
public static $requestedUrl = '';
/**
* Добавить маршрут
*/
public static function addRoute($route, $destination=null) {
if ($destination != null && !is_array($route)) {
$route = array($route => $destination);
}
self::$routes = array_merge(self::$routes, $route);
}
/**
* Разделить переданный URL на компоненты
*/
public static function splitUrl($url) {
return preg_split('/\//', $url, -1, PREG_SPLIT_NO_EMPTY);
}
/**
* Текущий обработанный URL
*/
public static function getCurrentUrl() {
return (self::$requestedUrl?:'/');
}
/**
* Обработка переданного URL
*/
public static function dispatch($requestedUrl = null) {
// Если URL не передан, берем его из REQUEST_URI
if ($requestedUrl === null) {
$uri = reset(explode('?', $_SERVER["REQUEST_URI"]));
$requestedUrl = urldecode(rtrim($uri, '/'));
}
self::$requestedUrl = $requestedUrl;
// если URL и маршрут полностью совпадают
if (isset(self::$routes[$requestedUrl])) {
self::$params = self::splitUrl(self::$routes[$requestedUrl]);
return self::executeAction();
}
foreach (self::$routes as $route => $uri) {
// Заменяем wildcards на рег. выражения
if (strpos($route, ':') !== false) {
$route = str_replace(':any', '(.+)', str_replace(':num', '([0-9]+)', $route));
}
if (preg_match('#^'.$route.'$#', $requestedUrl)) {
if (strpos($uri, '$') !== false && strpos($route, '(') !== false) {
$uri = preg_replace('#^'.$route.'$#', $uri, $requestedUrl);
}
self::$params = self::splitUrl($uri);
break; // URL обработан!
}
}
return self::executeAction();
}
/**
* Запуск соответствующего действия/экшена/метода контроллера
*/
public static function executeAction() {
$controller = isset(self::$params[0]) ? self::$params[0]: 'DefaultController';
$action = isset(self::$params[1]) ? self::$params[1]: 'default_method';
$params = array_slice(self::$params, 2);
return call_user_func_array(array($controller, $action), $params);
}
}
?>
<?php
// маршруты (можно хранить в конфиге приложения)
// можно использовать wildcards (подстановки):
// :any - любое цифробуквенное сочетание
// :num - только цифры
// в результирующее выражение записываются как $1, $2 и т.д. по порядку
$routes = array(
// 'url' => 'контроллер/действие/параметр1/параметр2/параметр3'
'/' => 'MainController/index', // главная страница
'/contacts' => 'MainController/contacts', // страница контактов
'/blog' => 'BlogController/index', // список постов блога
'/blog/:num' => 'BlogController/viewPost/$1' // просмотр отдельного поста, например, /blog/123
'/blog/:any/:num' => 'BlogController/$1/$2' // действия над постом, например, /blog/edit/123 или /blog/dеlete/123
'/:any' => 'MainController/anyAction' // все остальные запросы обрабатываются здесь
));
// добавляем все маршруты за раз
RouterLite::addRoute($routes);
// а можно добавлять по одному
RouterLite::addRoute('/about', 'MainController/about');
// непосредственно запуск обработки
RouterLite::dispatch();
?>
NameVirtualHost 127.0.0.1:8080
NameVirtualHost 127.0.0.1:8090
Listen 127.0.0.1:8080
Listen 127.0.0.1:8090
<VirtualHost 127.0.0.1:8090>
. . .
DocumentRoot /usr/share/redmine/public
. . .
</VirtualHost>
<VirtualHost 127.0.0.1:8080>
. . .
DocumentRoot /var/www/dev.site
. . .
</VirtualHost>
server {
listen 80;
server_name dev.site;
server_name_in_redirect off;
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
proxy_connect_timeout 90;
}
}
server {
listen 80;
server_name task.site;
server_name_in_redirect off;
location / {
proxy_pass http://127.0.0.1:8090/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
proxy_connect_timeout 90;
}
}
proxy_pass http://127.0.0.1:8080/
, а для task.site — proxy_pass http://127.0.0.1:8090/
.<VirtualHost *:8080>
нужно писать <VirtualHost 127.0.0.1:8080>
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|js|pdf)$ {
root /var/www/dev.site;
}
$lang['mTitle']='Главная';
$lang['mAbout']='О нас';
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} acs [NC,OR]
RewriteCond %{HTTP_USER_AGENT} alav [NC,OR]
RewriteCond %{HTTP_USER_AGENT} alca [NC,OR]
RewriteCond %{HTTP_USER_AGENT} amoi [NC,OR]
RewriteCond %{HTTP_USER_AGENT} audi [NC,OR]
RewriteCond %{HTTP_USER_AGENT} aste [NC,OR]
RewriteCond %{HTTP_USER_AGENT} avan [NC,OR]
RewriteCond %{HTTP_USER_AGENT} benq [NC,OR]
RewriteCond %{HTTP_USER_AGENT} bird [NC,OR]
RewriteCond %{HTTP_USER_AGENT} blac [NC,OR]
RewriteCond %{HTTP_USER_AGENT} blaz [NC,OR]
RewriteCond %{HTTP_USER_AGENT} brew [NC,OR]
RewriteCond %{HTTP_USER_AGENT} cell [NC,OR]
RewriteCond %{HTTP_USER_AGENT} cldc [NC,OR]
RewriteCond %{HTTP_USER_AGENT} cmd- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} dang [NC,OR]
RewriteCond %{HTTP_USER_AGENT} doco [NC,OR]
RewriteCond %{HTTP_USER_AGENT} eric [NC,OR]
RewriteCond %{HTTP_USER_AGENT} hipt [NC,OR]
RewriteCond %{HTTP_USER_AGENT} inno [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ipaq [NC,OR]
RewriteCond %{HTTP_USER_AGENT} java [NC,OR]
RewriteCond %{HTTP_USER_AGENT} jigs [NC,OR]
RewriteCond %{HTTP_USER_AGENT} kddi [NC,OR]
RewriteCond %{HTTP_USER_AGENT} keji [NC,OR]
RewriteCond %{HTTP_USER_AGENT} leno [NC,OR]
RewriteCond %{HTTP_USER_AGENT} lg-c [NC,OR]
RewriteCond %{HTTP_USER_AGENT} lg-d [NC,OR]
RewriteCond %{HTTP_USER_AGENT} lg-g [NC,OR]
RewriteCond %{HTTP_USER_AGENT} lge- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} maui [NC,OR]
RewriteCond %{HTTP_USER_AGENT} maxo [NC,OR]
RewriteCond %{HTTP_USER_AGENT} midp [NC,OR]
RewriteCond %{HTTP_USER_AGENT} mits [NC,OR]
RewriteCond %{HTTP_USER_AGENT} mmef [NC,OR]
RewriteCond %{HTTP_USER_AGENT} mobi [NC,OR]
RewriteCond %{HTTP_USER_AGENT} mot- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} moto [NC,OR]
RewriteCond %{HTTP_USER_AGENT} mwbp [NC,OR]
RewriteCond %{HTTP_USER_AGENT} nec- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} newt [NC,OR]
RewriteCond %{HTTP_USER_AGENT} noki [NC,OR]
RewriteCond %{HTTP_USER_AGENT} opwv [NC,OR]
RewriteCond %{HTTP_USER_AGENT} palm [NC,OR]
RewriteCond %{HTTP_USER_AGENT} pana [NC,OR]
RewriteCond %{HTTP_USER_AGENT} pant [NC,OR]
RewriteCond %{HTTP_USER_AGENT} pdxg [NC,OR]
RewriteCond %{HTTP_USER_AGENT} phil [NC,OR]
RewriteCond %{HTTP_USER_AGENT} play [NC,OR]
RewriteCond %{HTTP_USER_AGENT} pluc [NC,OR]
RewriteCond %{HTTP_USER_AGENT} port [NC,OR]
RewriteCond %{HTTP_USER_AGENT} prox [NC,OR]
RewriteCond %{HTTP_USER_AGENT} qtek [NC,OR]
RewriteCond %{HTTP_USER_AGENT} qwap [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sage [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sams [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sany [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sch- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sec- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} send [NC,OR]
RewriteCond %{HTTP_USER_AGENT} seri [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sgh- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} shar [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sie- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} siem [NC,OR]
RewriteCond %{HTTP_USER_AGENT} smal [NC,OR]
RewriteCond %{HTTP_USER_AGENT} smar [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sony [NC,OR]
RewriteCond %{HTTP_USER_AGENT} sph- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} symb [NC,OR]
RewriteCond %{HTTP_USER_AGENT} t-mo [NC,OR]
RewriteCond %{HTTP_USER_AGENT} teli [NC,OR]
RewriteCond %{HTTP_USER_AGENT} tim- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} tosh [NC,OR]
RewriteCond %{HTTP_USER_AGENT} tsm- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} upg1 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} upsi [NC,OR]
RewriteCond %{HTTP_USER_AGENT} vk-v [NC,OR]
RewriteCond %{HTTP_USER_AGENT} voda [NC,OR]
RewriteCond %{HTTP_USER_AGENT} w3cs [NC,OR]
RewriteCond %{HTTP_USER_AGENT} wap- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} wapa [NC,OR]
RewriteCond %{HTTP_USER_AGENT} wapi [NC,OR]
RewriteCond %{HTTP_USER_AGENT} wapp [NC,OR]
RewriteCond %{HTTP_USER_AGENT} wapr [NC,OR]
RewriteCond %{HTTP_USER_AGENT} webc [NC,OR]
RewriteCond %{HTTP_USER_AGENT} winw [NC,OR]
RewriteCond %{HTTP_USER_AGENT} winw [NC,OR]
RewriteCond %{HTTP_USER_AGENT} xda [NC,OR]
RewriteCond %{HTTP_USER_AGENT} xda- [NC,OR]
RewriteCond %{HTTP_USER_AGENT} up.browser [NC,OR]
RewriteCond %{HTTP_USER_AGENT} up.link [NC,OR]
RewriteCond %{HTTP_USER_AGENT} windows.ce [NC,OR]
RewriteCond %{HTTP_USER_AGENT} iemobile [NC,OR]
RewriteCond %{HTTP_USER_AGENT} mini [NC,OR]
RewriteCond %{HTTP_USER_AGENT} mmp [NC,OR]
RewriteCond %{HTTP_USER_AGENT} symbian [NC,OR]
RewriteCond %{HTTP_USER_AGENT} midp [NC,OR]
RewriteCond %{HTTP_USER_AGENT} wap [NC,OR]
RewriteCond %{HTTP_USER_AGENT} phone [NC,OR]
RewriteCond %{HTTP_USER_AGENT} pocket [NC,OR]
RewriteCond %{HTTP_USER_AGENT} mobile [NC,OR]
RewriteCond %{HTTP_USER_AGENT} pda [NC,OR]
RewriteCond %{HTTP_USER_AGENT} PPC [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Series60 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Opera.Mini [NC]
RewriteCond %{HTTP_USER_AGENT} !windows.nt [NC]
RewriteCond %{HTTP_USER_AGENT} !bsd [NC]
RewriteCond %{HTTP_USER_AGENT} !x11 [NC]
RewriteCond %{HTTP_USER_AGENT} !unix [NC]
RewriteCond %{HTTP_USER_AGENT} !macos [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]
RewriteCond %{HTTP_USER_AGENT} !playstation [NC]
RewriteCond %{HTTP_USER_AGENT} !google [NC]
RewriteCond %{HTTP_USER_AGENT} !yandex [NC]
RewriteCond %{HTTP_USER_AGENT} !bot [NC]
RewriteCond %{HTTP_USER_AGENT} !libwww [NC]
RewriteCond %{HTTP_USER_AGENT} !msn [NC]
RewriteCond %{HTTP_USER_AGENT} !america [NC]
RewriteCond %{HTTP_USER_AGENT} !avant [NC]
RewriteCond %{HTTP_USER_AGENT} !download [NC]
RewriteCond %{HTTP_USER_AGENT} !fdm [NC]
RewriteCond %{HTTP_USER_AGENT} !maui [NC]
RewriteCond %{HTTP_USER_AGENT} !webmoney [NC]
RewriteCond %{HTTP_USER_AGENT} !windows-media-player [NC]
RewriteCond %{QUERY_STRING} !wpc_nr [NC]
RewriteRule ^(.*)$ site.ru/ [L,R=302]