phpwind iis下伪静态规则
[ISAPI_Rewrite]
RewriteRule ^(.*)/(.*)-htm-(.*)-(.*)\.html$ $1/$2\.php\?$3=$4
RewriteRule ^(.*)/read-htm-tid-(.*)\.html$ $1/read\.php\?tid=$2
RewriteRule ^(.*)/thread-htm-fid-(.*)\.html$ $1/thread\.php\?fid=2
RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index\.php\?$2
phpwind apache下伪静态规则
RewriteEngine On
RewriteRule ^(.*)/thread-htm-tid-(\d+)-(.*).html  $1/thread.php?fid=$2
RewriteRule ^(.*)/read-htm-tid-(\d+)-(.*).html  $1/read.php?tid=$2
RewriteRule ^(.*)/commtopics-(\d+)-(.*)$ $1/thread.php?fid=$2&page=$3
RewriteRule ^(.*)/commtopics-(.*)$      $1/thread.php?fid=$2&page=$3
RewriteRule ^(.*)/article-(\d+)-(\d+)-(.*).html$  $1/read.php?tid=$2&page=$3&fpage=$4
RewriteRule ^(.*)/article-(\d+)-(.*).html$       $1/read.php?tid=$2&page=$3
RewriteRule ^(.*)/article-(.*).html$         $1/read.php?tid=$2
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
phpwind nginx下伪静态规则
location / {
rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;
}

function urlRewrite($url) {
    global $db_htmifopen, $db_dir, $db_ext;
    if (!$db_htmifopen) return $url;
    $tmppos = strpos($url, '#');
    $add = $tmppos !== false ? substr($url, $tmppos) : '';
    $turl = str_replace(array('.php?', '=', '&', '&', $add), array($db_dir, '-', '-', '-', ''), $url);
    $turl != $url && $turl .= $db_ext;
    return $turl . $add;
}
替换成
function urlRewrite($url) {
    global $db_htmifopen, $db_dir, $db_ext;
    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'] = 4;
                break;
                }}}
         switch($URL_type['type']){
           case '1':
               $url = "commtopics-" . $URL_type['fid'] ; break;                
           case '2':
               $url = "commtopics-" . $URL_type['fid'] . "-" . $URL_type['page'] ;   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 = "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;
                 }
             }
        //      $url .= $db_ext;  很多人以为后缀问题,故作特处理。
    return $url . $add;
}
规则如下.  添加到httpd.ini或者.htaccess 或者其他
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^thread-htm-tid-(\d+)-(.*).html  thread.php?fid=$1
RewriteRule ^read-htm-tid-(\d+)-(.*).html  read.php?tid=$1
RewriteRule ^commtopics-(\d+)-(.*)  thread.php?fid=$1&page=$2
RewriteRule ^commtopics-(.*)       thread.php?fid=$1&page=$2
RewriteRule ^article-(\d+)-(\d+)-(.*).html  read.php?tid=$1&page=$2&fpage=$3 
RewriteRule ^article-(\d+)-(\d+).html       read.php?tid=$1&page=$2
RewriteRule ^article-(.*).html             read.php?tid=$1
RewriteRule ^(.*)-htm-(.*).html    $1.php?$2
RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
</IfModule>

PHPwind高级伪静态规则及方法的更多相关文章

  1. phpwind伪静态规则(IIS,Nginx,Apache)的介绍及代码

    phpwind iis下伪静态规则[ISAPI_Rewrite]RewriteRule ^(.*)/(.*)-htm-(.*)-(.*).html$ $1/$2.php?$3=$4RewriteRul ...

  2. Nginx伪静态配置和常用Rewrite伪静态规则集锦

    伪静态是一种可以把文件后缀改成任何可能的一种方法,如果我想把php文件伪静态成html文件,这种相当简单的,下面我来介绍nginx 伪静态配置方法 nginx里使用伪静态是直接在nginx.conf ...

  3. [转]Nginx伪静态配置和常用Rewrite伪静态规则集锦

    Nginx伪静态配置和常用Rewrite伪静态规则集锦 作者: 字体:[增加 减小] 类型:转载 时间:2014-06-10 我要评论 伪静态是一种可以把文件后缀改成任何可能的一种方法,如果我想把ph ...

  4. Nginx常用伪静态规则(rewrite)-Discuz X3.2-WordPress-PHPCMS-ECSHOP-SHOPE(转)

    当我们从apache服务器转向Nginx服务器的时候,它们的伪静态规则就不一样了,所以你熟悉Nginx服务器的伪静态规则,自己写当然也好.不了解Nginx服务器的伪静态规则的,为方便各位站长,收集了这 ...

  5. 伪静态规则写法RewriteRule-htaccess详细语法使用

    一.正则表达式教程伪静态规则写法RewriteRule-htaccess详细语法使用教程分享简单说下:伪静态实际上是利用PHP把当前地址解析成另外一种方法进行访问网站!要学伪静态规则的写法,你必须得懂 ...

  6. WIN8 、WIN7 下IIS7.5、IIS8 的rewrite 伪静态功能设置方法

    原文 WIN8 .WIN7 下IIS7.5.IIS8 的rewrite 伪静态功能设置方法 win7和win8系统都自带有iis的功能.关于IIS的安装,上一篇已经讲述,这里就不重复了. 下面说下在w ...

  7. 转--htaccess语法教程 apache服务器伪静态规则教程

    转自:http://blog.csdn.net/qingli518/article/details/9118361 htaccess语法教程apache服务器伪静态规则教程 注:如果你是为了找Disc ...

  8. 7.nginx伪静态规则

    网上收集的一些常用的,要用的时候就仿照一下,或直接拿来用. WordPress伪静态规则 location / { index index.html index.php; if (-f $reques ...

  9. 伪静态规则RewriteRule-htaccess

    伪静态实际上是利用php把当前地址解析成另一种方法来访问网站,要学伪静态规则的写法,要懂一点正则 一.正则表达式教程 有一个经典的教程:正则表达式30分钟入门教程 常用正则如下: . 换行符以外的所有 ...

随机推荐

  1. zk jquery的使用

    jQuery_effects.zul: <?page title="Jquery" contentType="text/html;charset=UTF-8&quo ...

  2. Maven3下的java web项目

    咱们使用Maven3构建一个j2ee项目,项目的成果是一个war包,只需把它部署在服务器上,就可以使用浏览器访问. 具体详细信息 参考  http://www.mossle.com/docs/mave ...

  3. bzoj3594: [Scoi2014]方伯伯的玉米田--树状数组优化DP

    题目大意:对于一个序列,可以k次选任意一个区间权值+1,求最长不下降子序列最长能为多少 其实我根本没想到可以用DP做 f[i][j]表示前i棵,操作j次,最长子序列长度 p[x][y]表示操作x次后, ...

  4. SpringMVC如何接收application/json内容编码类型的参数?

    在上代码之前,有必要先说说@ResquestBody注解的含义: 1.官方解释如下: Annotation indicating a method parameter should be bound ...

  5. java动态编译类文件并加载到内存中

    如果你想在动态编译并加载了class后,能够用hibernate的数据访问接口以面向对象的方式来操作该class类,请参考这篇博文-http://www.cnblogs.com/anai/p/4270 ...

  6. 执行JDBC的executeUpdate()方法时,报错:数据类型不一致,应为number,但却为binary

    该原因是因为,在拼写update语句的时候将一个number类型的字段的值赋为了null导致的,如果想将一个number类型的字清空,不能使用null,可以使用“”来替代.

  7. c# 基础部分 (基本数据类型-- 表达式)

    一 基础部分 1.常用的基本数据类型 int  longing(长整) shortint(短整) string(文本型) char(字符型) bool (布尔型) false true 2.常量于变量 ...

  8. 在PHP与HTML混合输入的页面或者模板中就需要对PHP代码进行闭合

    PHP程序的时候会在文件的最后加上一个闭合标签,如下: <?phpclass MyClass{public function test(){//do something, etc.}}?> ...

  9. JAVA程序设计 实验一

    北京电子科技学院(BESTI) 实     验    报     告 课程:Java程序设计 班级:1353  姓名:李海空  学号:20135329 成绩:             指导教师:娄嘉鹏 ...

  10. mysql分区

    <?php /* 分区 目录 18.1. MySQL中的分区概述 18.2. 分区类型 18.2.1. RANGE分区 18.2.2. LIST分区 18.2.3. HASH分区 18.2.4. ...