0) foreach ($banned as $bannedstr) if (strpos($uri, $bannedstr)!==false) { $bannedfl = true; break; } if ($redir404 AND parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)!==$_SERVER['SERVER_NAME'] AND !$bannedfl) { header("HTTP/1.1 301 Moved Permanently"); header('Location: https://'.$_SERVER['SERVER_NAME'].'/'); exit(); } header("HTTP/1.1 404 Not Found"); $content = file_get_contents("404.html"); $str404 = preg_replace('/[^ a-zа-яё\d]/ui', ' ', urldecode($_SERVER['REQUEST_URI'])); $content = preg_replace("/\(.*?)\<\/title\>/i","Ничего не найдено для $str404", $content); $contenthtml = true; } $arr1 = ['','','','','','','','','','','','']; $arr2 = [ '', //hdr '', //ftr '', //ad01 '', //ad02 '', //ad03 '', //ad04 '', //ad05 '', //ad06 '', //ad07 '', //ad08 '', //ad09 '' //ad10 ]; $liru = ''; $stmob = ''; /* $stmob = 'Open

' . '' . // прилипашка для мобильного '

Close
'; */ $stdsk = ''; /* $stdsk = ''; */ if ( empty($_SERVER['HTTP_USER_AGENT']) ) { $is_mobile = false; } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.) || strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false ) { $is_mobile = true; } else { $is_mobile = false; } if ($is_mobile) { $content = str_replace('', '', $content); $arr2[1] .= $stmob; } else { $content = str_replace('', $stdsk, $content); } $content = str_replace($arr1, $arr2, $content); $content = str_replace('', $liru, $content); if (strpos($uri, '/wp-json/')!==false) { if (strpos($uri, 'format=xml')!==false) { header("Content-Type: text/xml; charset=UTF-8"); } else { header("Content-Type: application/json; charset=UTF-8"); } header("X-Content-Type-Options: nosniff"); header("X-Robots-Tag: noindex"); header_remove("X-Powered-By"); } elseif ($uri=='/wp-json/') header("Content-Type: application/json; charset=UTF-8"); elseif ($contenthtml) header("content-type: text/html; charset=UTF-8"); header('link: ; rel="https://api.w.org/"'); header('cache-control: no-cache, must-revalidate, max-age=0'); header('expires: Wed, 11 Jan 1984 05:00:00 GMT'); echo $content; return; ?>