PHPCMS伪静态时rewrite匹配参数超过10个的处理方法 分类信息伪静态
来源:互联网 发布:mac icloud备份 编辑:程序博客网 时间:2024/06/08 04:05
我们知道,在伪静态中 rewrite 只能定义到$9的,超过了便无效了,而实际使用中却有需要9个以上参数的时候,那么怎么来解决呢?详见下文分解。
RewriteRule反向引用 ,引用方法是:$N (0 <= N <= 9)引用当前(带有若干RewriteRule指令的)RewriteCond中的与Pattern匹配的分组成分(圆括号!)。
RewriteCond反向引用 ,引用方法是:%N (1 <= N <= 9)引用当前若干RewriteCond条件中最后符合的条件中的分组成分(圆括号!)
授人以鱼不如授人以渔,下面来给大家演示下实现的过程
首先你要有个环境,要支持伪静态,然后测试。新建一个以1命名的web文件夹,并建立php文档,命名为:index.php 文档代码如下:
RewriteEngine On
RewriteRule ^a(.*)b(.*)c(.*)d(.*)e(.*)f(.*)g(.*)h(.*)$ $8&a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7 [C,NC]
RewriteRule ^(.*)i(.*)j(.*)k(.*)l(.*)m(.*)n(.*)$ index.php?$8&h=$1&i=$2&j=$3&k=$4&l=$5&m=$6&n=$7 [QSA,L,NC]
RewriteRule ^index-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?).html$ $9&a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7&h=$8 [C,NC]
RewriteRule ^(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)$ index.php?$7&i=$1&j=$2&k=$3&l=$4&m=$5&n=$6 [QSA,L,NC]
1.http://127.0.0.1/1/a1b2c3d4e5f6g7h8i9j10k11l12m13n14
2. http://127.0.0.1/1/index-1-2-3-4-5-6-7-8-9-10-11-12-13-14.html
如果你运行上面地址会出现1-14的数字则说明你的配置成功了
七个参数的情况下:
RewriteRule ^list-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?).html$ index.php?m=content&c=index&a=lists$8&catid=$1&city=$2&price=$3&rent_mode=$4&years=$5&zone=$6&page=$7
实践参数大于十个:
RewriteRule ^list-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?)-(.*?).html$ $9&catid=$1&city=$2&agent=$3&bedroom=$4&fittype=$5&houseallocation=$6&objecttype=$7&pay_type_int=$8 [C,NC]
RewriteRule ^(.*?)-(.*?)-(.*?)-(.*?)-(.*?)$ index.php?m=content&c=index&a=lists$6&price=$1&rent_mode=$2&toward=$3&zone=$4&page=$5 [QSA,L,NC]
$9不能去掉
地址要写在追加参数前面,因为在伪静态地址中后追加的参数在前面
- PHPCMS伪静态时rewrite匹配参数超过10个的处理方法 分类信息伪静态
- phpcms在nginx的rewrite伪静态标准写法
- phpcms伪静态设置方法
- Rewrite – Apache转Lighttpd的伪静态rewrite方法
- 配置PHPCMS伪静态
- phpcms修改伪静态
- phpcms URL伪静态
- ISAPI_Rewrite伪静态中出现中文参数的处理方法
- ISAPI_Rewrite伪静态中出现中文参数的处理方法
- destoon URL Rewrite(伪静态)设置方法
- PHPCMS伪静态设置方法小结
- IIS下伪静态html(URL Rewrite)的设置方法
- Apache下伪静态html(URL Rewrite)的设置方法
- destoon的URL Rewrite(伪静态)设置方法【完整步骤】
- Apache和Nginx设置伪静态(URL Rewrite)的方法
- nginx rewrite 参数和例子+常用Rewrite伪静态法则
- apache rewrite的伪静态实现
- Apache Rewrite 伪静态配置
- 测试工具之fiddler使用
- 调试经验
- UE4 iOS打包
- java中的多线程
- 常见设计模式之装饰者模式(Decorator)
- PHPCMS伪静态时rewrite匹配参数超过10个的处理方法 分类信息伪静态
- 二叉树判定树结构是否相同,值是否相同
- Maven的Setting.xml文件模板
- HashMap实现原理分析
- 【目标检测:Hough Forest】霍夫森林(Hough Forest)目标检测算法及其原理(二)
- HDU-2032 杨辉三角
- poj2387 Til the Cows Come Home
- 关于函数参数入栈顺序(完善中)
- 设计第二个弹出窗口(MessageBox)