开发者社区> 问答> 正文

管理来看看求助了。

我所使用的是自己的路
Nginx扩展设置
(location段)
location / {
rewrite ^(.*)-htm-(.*)$   $1\.php\?$2  last;
rewrite ^(.*)/simple/([a-z0-9_]+.html)$ $1/simple/index.php?$2  last;
rewrite ^index\.html$ index.php  last;
rewrite ^login\.html$ login.php  last;
rewrite ^register\.html$ register.php  last;
rewrite ^profile\.html$ profile.php  last;
rewrite ^(.*?)/([0-9]+)$ $1\.php\?uid=$2  last;
rewrite ^(.*)newhouse $1/index.php\?m=house&q=list last;
rewrite ^(.*)newhouse/ $1/index.php\?m=house&q=list  last;
rewrite ^(.*)esf $1/index.php\?m=house&q=sale  last;
rewrite ^(.*)esf/ $1/index.php\?m=house&q=sale  last;
rewrite ^(.*)czf $1/index.php\?m=house&q=hire  last;
rewrite ^(.*)czf/ $1/index.php\?m=house&q=hire  last;
rewrite ^(.*)jjr $1/index.php\?m=house&q=broker  last;
rewrite ^(.*)jjr/ $1/index.php\?m=house&q=broker  last;
rewrite ^(.*)zj $1/index.php\?m=house&q=broker&a=agencys  last;
rewrite ^(.*)zj/ $1/index.php\?m=house&q=broker&a=agencys  last;
rewrite ^(.*)agencys $1/index.php\?m=house&q=broker&a=agencys  last;
rewrite ^(.*)agencys/ $1/index.php\?m=house&q=broker&a=agencys  last;
rewrite ^(.*)news $1/index.php\?m=cms  last;
rewrite ^(.*)news/ $1/index.php\?m=cms  last;
rewrite ^(.*)bbs $1/index.php\?m=bbs  last;
rewrite ^(.*)bbs/ $1/index.php\?m=bbs  last;
rewrite ^(.*)jsq $1/index.php\?m=house&q=calculate&housetype=sale  last;
rewrite ^(.*)jsq/ $1/index.php\?m=house&q=calculate&housetype=sale  last;
rewrite ^(.*)jsq $1/index.php\?m=house&q=calculate&housetype=hire  last;
rewrite ^(.*)jsq/ $1/index.php\?m=house&q=calculate&housetype=hire  last;
rewrite ^(.*)bbs_(\d+) $1/thread.php\?fid=$2  last;
rewrite ^(.*)bbs_(\d+)/ $1/thread.php\?fid=$2  last;
rewrite ^(.*)bbs_(\d+)_(\d+) $1/thread.php\?fid=$2&page=$3  last;
rewrite ^(.*)ditu $1/index.php\?m=house&q=housemap&step=searchinfo  last;
rewrite ^(.*)ditu/ $1/index.php\?m=house&q=housemap&step=searchinfo  last;
rewrite ^(.*)esf_(\d+).html $1/index.php\?m=house&q=sale&a=houseinfo&houseid=$2  last;
rewrite ^(.*)czf_(\d+).html $1/index.php\?m=house&q=hire&a=houseinfo&houseid=$2  last;
rewrite ^(.*)newhouse_(\d+).html $1/index.php\?m=house&q=info&hid=$2  last;
rewrite ^(.*)newhouse_(\d+)_p.html $1/index.php\?m=house&q=album&hid=$2  last;
rewrite ^(.*)newhouse_(\d+)_p_(\d+).html $1/index.php\?m=house&q=album&hid=$2&typeid=$3  last;
rewrite ^(.*)shop_(\d+).html $1/index.php\?m=house&q=shop&uid=$2  last;
rewrite ^(.*)agencys_(\d+).html $1/index.php\?m=house&q=agency&agencyid=$2  last;
rewrite ^(.*)news_(\d+) $1/index.php\?m=cms&q=list&column=$2  last;
rewrite ^(.*)news_(\d+)/ $1/index.php\?m=cms&q=list&column=$2  last;
rewrite ^(.*)news_(\d+).html $1/index.php\?m=cms&q=view&id=$2  last;
rewrite ^(.*)bbs_(\d+).html $1/read.php\?tid=$2  last;
rewrite ^(.*)zj_(\d+).html $1/index.php\?m=house&q=agency&agencyid=$2  last;
rewrite ^(.*)zj_(\d+).html $1/index.php\?m=house&q=agency&agencyid=$2&a=sale  last;
rewrite ^(.*)zjczf_(\d+).html $1/index.php\?m=house&q=agency&agencyid=$2&a=hire  last;
rewrite ^(.*)zjtd_(\d+).html $1/index.php\?m=house&q=agency&agencyid=$2&a=member  last;
rewrite ^(.*)esf_(\d+) $1/index.php\?m=house&q=sale&act=all&page=$2  last;
rewrite ^(.*)czf_(\d+) $1/index.php\?m=house&q=hire&act=all&page=$2  last;
rewrite ^(.*)newhouse_(\d+) $1/index.php\?m=house&q=list&page=$2  last;
rewrite ^(.*)shopesf_(\d+).html $1/index.php\?m=house&q=shop&uid=$2&a=hire  last;
rewrite ^(.*)shopczf_(\d+).html $1/index.php\?m=house&q=shop&uid=$2&a=sale  last;
rewrite ^(.*)shopinfo_(\d+).html $1/index.php\?m=house&q=shop&uid=$2&a=info  last;

}

上面步骤在(location段)规则添加成功了但是 在common.php修改了一下


/**
* 判断用户是否有前台可视化管理权限
*/
function checkPortalRight() {
global $db_portal_admins,$manager,$winduid,$windid;
return S::inArray($windid,$manager) || ($winduid && in_array($winduid, $db_portal_admins));
}
function descriplog($message) {
$message = str_replace(array("\n \n \n", "\n",'',''),array('<br />','<br />','<b>','</b>'),$message);
if (strpos($message,'[/URL]')!==false || strpos($message,'[/url]')!==false) {
  $message = preg_replace("/\[url=([^\[]+?)\](.*?)\[\/url\]/is","<a href=\"\\1\" target=\"_blank\">\\2</a>",$message);
}
return $message;
}
function parseHtmlUrlRewrite($html, $flag) {
return $flag ? preg_replace("/\<a(\s*[^\>]+\s*)href\=([\"|\']?)((index|cate|thread|read|faq|rss)\.php\?[^\"\'>\s]+\s?)[\"|\']?/ies", "Htm_cv('\\3','<a\\1href=\"')", $html) : $html;
}
/**
* url处理
*
* @param string $url
* @param string $tag
* @return string
*/
function Htm_cv($url, $tag) {
return stripslashes($tag) . urlRewrite($url) . '"';
}
function urlRewrite($url) {
        if($url=='index.php?m=house&q=list'){
                        $url="newhouse"; }//分类
        if($url=='index.php?m=house&q=sale'){
                        $url="esf"; }//分类
        if($url=='index.php?m=house&q=hire'){
                        $url="czf"; }//分类
        if($url=='index.php?m=house&q=broker'){
                        $url="jjr"; }//分类
        if($url=='index.php?m=house&q=broker&a=agencys'){
                        $url="agencys"; }//分类
        if($url=='index.php?m=cms'){
                        $url="news"; }//分类
        if($url=='index.php?m=bbs'){
                        $url="bbs"; }//分类
        if($url=='index.php?m=house&q=calculate&housetype=sale'){
                        $url="jsq"; }//分类
        if($url=='index.php?m=house&q=calculate&housetype=hire'){
                        $url="jsq"; }//分类
        if($url=='mode.php?m=house&q=housemap&step=searchinfo'){
                        $url="ditu"; }//分类
        if($url=='agencys'){
                        $url="zj"; }//分类
if(strpos($url, 'index.php?m=house&q=info&hid=') !== false){
                        $newhouse_array = explode('&', substr(str_replace('', '', $url), 9));
                        foreach($newhouse_array as $key => $value){
                             $URL_array = explode('=', $value, 2);
                        }
                        $url="newhouse_".$URL_array['1'].".html"; //详细页新房
                    }
if(strpos($url, 'index.php?m=house&q=sale&a=houseinfo&houseid=') !== false){
                        $esf_array = explode('&', substr(str_replace('', '', $url), 9));
                        foreach($esf_array as $key => $value){
                             $URL_array = explode('=', $value, 2);
                        }
                        $url="esf_".$URL_array['1'].".html"; //详细页二手房
                    }
if(strpos($url, 'index.php?m=house&q=list&page=') !== false){
                        $newhouse_array = explode('&', substr(str_replace('', '', $url), 9));
                        foreach($newhouse_array as $key => $value){
                             $URL_array = explode('=', $value, 2);
                        }
                        $url="newhouse_".$URL_array['1'].""; //列表页新房
                    }
if(strpos($url, 'index.php?m=house&q=sale&act=all&page=') !== false){
                        $esf_array = explode('&', substr(str_replace('', '', $url), 9));
                        foreach($esf_array as $key => $value){
                             $URL_array = explode('=', $value, 2);
                        }
                        $url="esf_".$URL_array['1'].""; //列表页二手房
                    }
if(strpos($url, 'index.php?m=house&q=hire&act=all&page=') !== false){
                        $czf_array = explode('&', substr(str_replace('', '', $url), 9));
                        foreach($czf_array as $key => $value){
                             $URL_array = explode('=', $value, 2);
                        }
                        $url="czf_".$URL_array['1'].""; //列表页出租房
                    }
if(strpos($url, 'index.php?m=house&q=hire&a=houseinfo&houseid=') !== false){
                        $czf_array = explode('&', substr(str_replace('', '', $url), 9));
                        foreach($czf_array as $key => $value){
                             $URL_array = explode('=', $value, 2);
                        }
                        $url="czf_".$URL_array['1'].".html"; //详细页出租房
                    }
if(strpos($url, 'index.php?m=cms&q=list&column=') !== false){
                        $news_array = explode('&', substr(str_replace('', '', $url), 9));
                        foreach($news_array as $key => $value){
                             $URL_array = explode('=', $value, 2);
                        }
                        $url="news_".$URL_array['1']."/"; //详细页资讯
                    }
if(strpos($url, 'index.php?m=cms&q=view&id=') !== false){
                        $news_array = explode('&', substr(str_replace('', '', $url), 9));
                        foreach($news_array as $key => $value){
                             $URL_array = explode('=', $value, 2);
                        }
                        $url="news_".$URL_array['1'].".html"; //详细页资讯页
                    }

    global $db_htmifopen, $db_dir, $db_ext;
    if (!$db_htmifopen) return $url;
    if(strpos($url, 'thread.php?') !== false){
         unset($URL_type);
         $Thread_array = explode('&', substr(str_replace($add, '', $url), 11));
          foreach($Thread_array as $key => $value){
             $URL_array = explode('=', $value, 2);
              if($URL_array['1']){
               switch($URL_array['0']){
                case 'fid':
                    $URL_type['fid'] = $URL_array['1'];
                    $URL_type['type'] < 1 && $URL_type['type'] = 1;
                break;
                case 'page':
                    $URL_type['page'] = $URL_array['1'];
                    $URL_type['type'] < 2 && $URL_type['type'] = 2;
                break;
                default:
                    $URL_type['type'] = 3;
                break;
                }}}
         switch($URL_type['type']){
           case '1':
               $url = "bbs_" . $URL_type['fid'] . "/" ; break;                
           case '2':
               $url = "bbs_" . $URL_type['fid'] . "_" . $URL_type['page'] ;   break;
             }}
elseif(strpos($url, 'index.php?') !== false){
                unset($URL_type);
                $tmppos = strpos($url, '#');
                $add = $tmppos !== false ? substr($url, $tmppos) : '';  
              $Index_array = explode('&', substr(str_replace($add, '', $url), 9));
                foreach($Index_array as $key => $value){
                $URL_array = explode('=', $value, 2);
                if($URL_array['1']){
                    switch($URL_array['0']){
                        case 'm':
                            $URL_type['m'] = $URL_array['1'];
                            $URL_type['type'] < 1 && $URL_type['type'] = 1;
                            break;
                        case 'q':
                            $URL_type['q'] = $URL_array['1'];
                            $URL_type['type'] < 2 && $URL_type[type] = 2;
                            break;
                        case 'album':
                            $URL_type['album'] = $URL_array['1'];
                            $URL_type['type'] < 3 && $URL_type['type'] = 3;
                            break;
                        case 'typeid':
                            $URL_type['typeid'] = $URL_array['1'];
                            $URL_type['type'] < 4 && $URL_type['type'] = 4;
                            break;
                        default:
                            $URL_type['type'] = 5;
                            break;
                        }}}
          switch($URL_type['type']){
             case '1':
                 $url = "article-".$URL_type['tid']. ".html";
                 break;
             case '2':
                 $url = "article-".$URL_type['tid'] . "-" . $URL_type['page'] .    ".html";
                 break;
             case '3':
                 $url = "article-". $URL_type['tid'] . "-" . $URL_type['page'] . "-" . $URL_type['fpage'] . ".html";
                 break;
             case '3':
                 $url = "article-". $URL_type['tid'] . "-" . $URL_type['page'] . "-" . $URL_type['fpage'] . ".html";
                 break;
                 }
             }
elseif(strpos($url, 'read.php?') !== false){
                unset($URL_type);
                $tmppos = strpos($url, '#');
                $add = $tmppos !== false ? substr($url, $tmppos) : '';
                $Read_array = explode('&', substr(str_replace($add, '', $url), 9));
                foreach($Read_array as $key => $value){
                $URL_array = explode('=', $value, 2);
                if($URL_array['1']){
                    switch($URL_array['0']){
                        case 'tid':
                            $URL_type['tid'] = $URL_array['1'];
                            $URL_type['type'] < 1 && $URL_type['type'] = 1;
                            break;
                        case 'page':
                            $URL_type['page'] = $URL_array['1'];
                            $URL_type['type'] < 2 && $URL_type[type] = 2;
                            break;
                        case 'fpage':
                            $URL_type['fpage'] = $URL_array['1'];
                            $URL_type['type'] < 3 && $URL_type['type'] = 3;
                            break;
                        default:
                            $URL_type['type'] = 4;
                            break;
                        }}}
          switch($URL_type['type']){
             case '1':
                 $url = "bbs_".$URL_type['tid']    . ".html";
                 break;
             case '2':
                 $url = "bbs_".$URL_type['tid'] . "_" . $URL_type['page'] .    ".html";
                 break;
             case '3':
                 $url = "bbs_". $URL_type['tid'] . "_" . $URL_type['page'] . "-" . $URL_type['fpage'] . ".html";
                 break;
                 }
             }
            return $url . $add;
        }

能访问但是链接打不看了请问哪里

展开
收起
zjwzami 2011-10-04 16:22:02 12934 0
3 条回答
写回答
取消 提交回答
  • 收费套餐、免费套餐的来群里报道啦!大讨论群:170836581
    2011-10-06 11:10:35
    赞同 展开评论 打赏
  • google一下,您就知道。
    2011-10-04 22:31:43
    赞同 展开评论 打赏
  • 管理不管这种问题的。百度一下,你就知道。
    2011-10-04 22:21:56
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
AutoTalk第八期:自动化场景之高效创建安全合规新账号 立即下载
《一站式网络自动化管理平台》 立即下载
基于Terraform的自动化管理云上资源实践 立即下载