VPS侦探论坛

 找回密码
 注册
查看: 3992|回复: 3

[Apache] 军哥,nginx伪静态参数超过九个的规则要怎么写?

[复制链接]
发表于 2017-1-19 15:13:35 | 显示全部楼层 |阅读模式

军哥,你好。nginx伪静态参数超过九个的规则要怎么写?  现在我们的网站url上是可以显示超过9个参数的。但是我php后台接收不了第九个参数后的参数的值。我按百度上的教程配置了,但是php还是接收不了值,希望军哥有空指导一下,谢谢。

例如:http://zb.16rd.com/tasklist-p-19-hd_tag_tech_id-115-hd_indus_id-318-hd_tag_id-105.html这里九个参数 参数的值正常获取
例如:http://zb.16rd.com/tasklist-hd_indus_id-318-hd_tag_id-105-hd_tag_tech_id-115-p-19-o-7.html 这里十一个参数 ,第十一参数的值获取不了了;

伪静态规则:
location = /index.html {      

   if ( $host ~ 'zb.16rdtext.com' ){
                rewrite ^/index.html$ /index.php;
                rewrite ^/(\w+).html$ /index.php?do=$1;
                rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*).html$ /index.php?do=$1&$2=$3;
                rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*).html$ /index.php?do=$1&$2=$3&$4=$5;
                rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*).html$ /index.php?do=$1&$2=$3&$4=$5&$6=$7;
                rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*).html$ /index.php?do=$1&$2=$3&$4=$5&$6=$7&$8=$9;


rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(?'n0'\w+)-(?'n1'[^\-\#\%\?\&]*).html$ index.php?do=$1&$2=$3&$4=$5&$6=$7&$8=$9&$n0=$n1

rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(?'n0'\w+)-(?'n1'[^\-\#\%\?\&]*)-(?'n2'\w+)-(?'n3'[^\-\#\%\?\&]*).html$ index.php?do=$1&$2=$3&$4=$5&$6=$7&$8=$9&$n0=$n1&$n2=$n3

rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(?'n0'\w+)-(?'n1'[^\-\#\%\?\&]*)-(?'n2'\w+)-(?'n3'[^\-\#\%\?\&]*)-(?'n4'\w+)-(?'n5'[^\-\#\%\?\&]*).html$ index.php?do=$1&$2=$3&$4=$5&$6=$7&$8=$9&$n0=$n1&$n2=$n3&$n4=$n5

rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(?'n0'\w+)-(?'n1'[^\-\#\%\?\&]*)-(?'n2'\w+)-(?'n3'[^\-\#\%\?\&]*)-(?'n4'\w+)-(?'n5'[^\-\#\%\?\&]*)-(?'n6'\w+)-(?'n7'[^\-\#\%\?\&]*).html$ index.php?do=$1&$2=$3&$4=$5&$6=$7&$8=$9&$n0=$n1&$n2=$n3&$n4=$n5&$n6=$n7
        }
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-1-19 15:57:23 | 显示全部楼层


不大清楚,可以咨询一下你程序的开发方
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-1-19 17:22:39 | 显示全部楼层

  我就是程序员,好尴尬,我百度有说超过九个参数的要用重命名的方式
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2017-2-6 11:49:25 | 显示全部楼层

伪静态参数超过九个的问题




方法参考地址:
https://zhidao.baidu.com/question/937097964159925972.html?qbl=relate_question_0&word=nginx%CE%B1%BE%B2%CC%AC%B2%CE%CA%FD
分组捕获的规则:
如果伪静态参数超过九个,伪静态重写规则的要点是:左右两边都要有变量,
#################################贴图占位##################

.htaccess文件的完整内容:
location /{
        if ( $host ~ 'zb.16rdtext.com' ){
                rewrite ^/index.html$ /index.php;
                rewrite ^/(\w+).html$ /index.php?do=$1;
                rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*).html$ /index.php?do=$1&$2=$3;
                rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*).html$ /index.php?do=$1&$2=$3&$4=$5;
                rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*).html$ /index.php?do=$1&$2=$3&$4=$5&$6=$7;
                rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*).html$ /index.php?do=$1&$2=$3&$4=$5&$6=$7&$8=$9;
                rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-\#\%\?\&]*)-(?\w+)-(?'n1'[^\-\#\%\?\&]*).html$ /index.php?do=$1&$2=$3&$4=$5&$6=$7&$8=$9&$n0=$n1;
                rewrite ^/(\w+)-(\w+)-([^\-\#\%\?\&]*)-(\w+)-([^\-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#\%\?\&]*)-(?'n7'[^\-\#\%\?\&]*)-(?'n8'[^\-\#\%\?\&]*)-(?'n9'[^\-\#\%\?\&]*).html$ /index.php?do=$1&$2=$3&$4=$5&$6=$7&$8=$9&$n0=$n1&$n2=$n3&$n4=$n5&$n6=$n7&$n8=$n9;
        }
}


location = /index.html {
        if ( $host ~ 'zb.16rdtext.com' ){
                 rewrite ^(.*)$ /index.php;
        }
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-11-23 10:31 , Processed in 0.030461 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表