// +---------------------------------------------------------------------- // [ 应用入口文件 ] // 定义应用目录 define('APP_PATH', __DIR__ . '/../application/'); // 判断是否安装 if (!is_file(APP_PATH . 'admin/command/Install/install.lock')) { header("location:./install.php"); exit; } // 获取当前访问的URL $currentUrl = $_SERVER['REQUEST_URI']; // 定义匹配的正则表达式 if($currentUrl == '/xiaoshuo/news/all'){ $newUrl = "/news"; // 进行跳转,并使用301状态码 header("Location: " . $newUrl, true, 301); exit; } //if(!preg_match("/\/news\/(\d+).html$/i",$currentUrl,$matches) && !preg_match("/\/xiaoshuo\/(\d+).html$/i",$currentUrl,$matches)){ if(strpos($currentUrl,"news") === false){ if(strpos($currentUrl,"xiaoshuo") === false){ if(preg_match("/(\d+).html$/i",$currentUrl,$matches)){ // 组合新的网址 $newUrl = "/news/".$matches[1].".html"; // 进行跳转,并使用301状态码 header("Location: " . $newUrl, true, 301); exit; } if(preg_match("/\/(\d+).html\/[feed]+$/i",$currentUrl,$matches)){ // 组合新的网址 $newUrl = "/news/".$matches[1].".html"; // 进行跳转,并使用301状态码 header("Location: " . $newUrl, true, 301); exit; } if(preg_match("/\/\?p=(\d+)$/i",$currentUrl,$matches)){ // 组合新的网址 $newUrl = "/news/".$matches[1].".html"; // 进行跳转,并使用301状态码 header("Location: " . $newUrl, true, 301); exit; } } } if(preg_match("/\/e\/tags\/tagname=(.*)/i",$currentUrl,$matches)){ // 组合新的网址 $newUrl = "/tag/".$matches[1].".html"; // 进行跳转,并使用301状态码 header("Location: " . $newUrl, true, 301); exit; } if(preg_match("/\/xiaoshuo\/([a-zA-Z\-]+)\/page\/([\d]+)/i",$currentUrl,$matches)){ // 组合新的网址 $newUrl = "/".$matches[1]."?orderway=desc&page=".$matches[2]; // 进行跳转,并使用301状态码 header("Location: " . $newUrl, true, 301); exit; } if(preg_match("/\/([\w\-\d]+)\/page\/([\d]+)$/i",$currentUrl,$matches)){ // 组合新的网址 $newUrl = "/".$matches[1]."?orderway=desc&page=".$matches[2]; // 进行跳转,并使用301状态码 header("Location: " . $newUrl, true, 301); exit; } ///xiaoshuo/tag/xia-mo-ran/page/2 if(preg_match("/\/tag\/([a-zA-Z\-]+)\/page\/([\d]+)/i",$currentUrl,$matches)){ // 组合新的网址 $newUrl = "/tag/".$matches[1]."?orderway=desc&page=".$matches[2]; // 进行跳转,并使用301状态码 header("Location: " . $newUrl, true, 301); exit; } // 加载框架引导文件 require __DIR__ . '/../thinkphp/start.php';