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. 自己做的一个小demo

    上图: 主段代码: <script type="text/javascript"> var getRandomColor = function(){ return (f ...

  2. 20个有用的jq弹窗

    链接地址:http://www.ffpic.com/zixun/20-useful-jquery-modal-plugins.html 推荐:jQuery.bPopup.js

  3. apache本地域名ip重定向vhosts

    apache本地域名ip重定向,使本机通过指定域名访问到指定ip路径. 1.apache配置apache/conf/httpd.conf  : 开启配置 Include conf/extra/http ...

  4. javascript保留关键字

    1.通用保留关键字 break delete function return typeof case do if switch var catch else in this void continue ...

  5. str_replace() 用法bug和技巧

    语法 str_replace(find,replace,string,count) 参数 描述 find 必需.规定要查找的值. replace 必需.规定替换 find 中的值的值. string ...

  6. centos安装配置amoeba以及测试

    一.amoeba介绍网址:http://docs.hexnova.com/amoeba/ 二.安装java se1.5 三.安装amoeba2.2.01.下载地址:http://sourceforge ...

  7. == 与 equals

    参考:http://www.cnblogs.com/dolphin0520/p/3592500.html

  8. LNMP-Linux下Nginx+MySQL+PHP+phpMyAdmin+eAcelerator一键安装包

    LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RadHat.Debian/Ubuntu VPS(VDS)或独立主机安装LNMP(Nginx.MySQL.PHP.phpMyA ...

  9. 明白何谓Margin Collapse

    不同于其他很多属性,盒模型中垂直方向上的Margin会在相遇时发生崩塌,也就是说当某个元素的底部Margin与另一个元素的顶部Margin相邻时,只有二者中的较大值会被保留下来,可以从下面这个简单的例 ...

  10. blockdev命令和blkid命令

    blockdev命令和blkid命令 http://www.jb51.net/LINUXjishu/310389.html block相关的命令 这篇文章主要介绍了Linux blockdev命令设置 ...