PHPwind高级伪静态规则及方法
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高级伪静态规则及方法的更多相关文章
- phpwind伪静态规则(IIS,Nginx,Apache)的介绍及代码
phpwind iis下伪静态规则[ISAPI_Rewrite]RewriteRule ^(.*)/(.*)-htm-(.*)-(.*).html$ $1/$2.php?$3=$4RewriteRul ...
- Nginx伪静态配置和常用Rewrite伪静态规则集锦
伪静态是一种可以把文件后缀改成任何可能的一种方法,如果我想把php文件伪静态成html文件,这种相当简单的,下面我来介绍nginx 伪静态配置方法 nginx里使用伪静态是直接在nginx.conf ...
- [转]Nginx伪静态配置和常用Rewrite伪静态规则集锦
Nginx伪静态配置和常用Rewrite伪静态规则集锦 作者: 字体:[增加 减小] 类型:转载 时间:2014-06-10 我要评论 伪静态是一种可以把文件后缀改成任何可能的一种方法,如果我想把ph ...
- Nginx常用伪静态规则(rewrite)-Discuz X3.2-WordPress-PHPCMS-ECSHOP-SHOPE(转)
当我们从apache服务器转向Nginx服务器的时候,它们的伪静态规则就不一样了,所以你熟悉Nginx服务器的伪静态规则,自己写当然也好.不了解Nginx服务器的伪静态规则的,为方便各位站长,收集了这 ...
- 伪静态规则写法RewriteRule-htaccess详细语法使用
一.正则表达式教程伪静态规则写法RewriteRule-htaccess详细语法使用教程分享简单说下:伪静态实际上是利用PHP把当前地址解析成另外一种方法进行访问网站!要学伪静态规则的写法,你必须得懂 ...
- WIN8 、WIN7 下IIS7.5、IIS8 的rewrite 伪静态功能设置方法
原文 WIN8 .WIN7 下IIS7.5.IIS8 的rewrite 伪静态功能设置方法 win7和win8系统都自带有iis的功能.关于IIS的安装,上一篇已经讲述,这里就不重复了. 下面说下在w ...
- 转--htaccess语法教程 apache服务器伪静态规则教程
转自:http://blog.csdn.net/qingli518/article/details/9118361 htaccess语法教程apache服务器伪静态规则教程 注:如果你是为了找Disc ...
- 7.nginx伪静态规则
网上收集的一些常用的,要用的时候就仿照一下,或直接拿来用. WordPress伪静态规则 location / { index index.html index.php; if (-f $reques ...
- 伪静态规则RewriteRule-htaccess
伪静态实际上是利用php把当前地址解析成另一种方法来访问网站,要学伪静态规则的写法,要懂一点正则 一.正则表达式教程 有一个经典的教程:正则表达式30分钟入门教程 常用正则如下: . 换行符以外的所有 ...
随机推荐
- HDU1134/HDU1133 递推 大数 java
Game of Connections Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Othe ...
- Hack技术
Hack技术 1.IE条件注释法,微软官方推荐的hack方式. 只在IE下生效 <!--[if IE]> <link rel="stylesheet" href= ...
- 非静态的字段、方法或属性“System.Web.UI.Page.ClientScript...”要求对象引用 (封装注册脚本)
在写项目时想对asp.net的注册前台脚本事件进行封装,就添加了一个BasePage.cs页面,但一直报错‘非静态的字段.方法或属性“System.Web.UI.Page.ClientScript.. ...
- Emule Xtreme Kid eD2K 设置
设置udp和tcp端口: 测试结果必须为通过,若不通过, 1.请将主机ip丢入路由器DMZ区(设置将以上端口与本机ip地址绑定) 2.在windows防火墙中加入以上端口允许通行项 测试结果: 其它一 ...
- include文件时尽量使用绝对路径
1.如果能将类的方法定义成static,就尽量定义成static,它的速度会提升将近4倍. 2.$row['id'] 的速度是$row[id]的7倍. 3.echo 比 print 快,并且使用ech ...
- BizTalk 开发系列(四十二) 为BizTalk应用程序打包不同的环境Binding
我们在使用微软或者其他公司提供的BizTalk应用程序MSI包的时候经常会有一个目标环境的选择选项.该选项可以在不同的环境下使用不同的绑定(BizTalk应用程序配置)感觉很高级. 其实这个非常的简单 ...
- 分割excel sheet
Sub split_sheet() '输入用户想要拆分的工作表 Dim sheet_name sheet_name = Application.InputBox("请输入拆分工作表的名称:& ...
- Thinking in Java——笔记(8)
Polymorphism The polymorphic method call allows one type to express its distinction from another, si ...
- sql cross join table
A 表数据如下图所示 B表数据如下图所示
- [转]线性插值&双线性插值&三线性插值
转自:http://www.cnblogs.com/yingying0907/archive/2012/11/21/2780092.html 內插是数学领域数值分析中的通过已知的离散数据求未知数据的过 ...